strip leading zeros in awk program

后端 未结 5 1502
孤城傲影
孤城傲影 2020-12-19 20:28

So I\'m pretty lost as I missed a week and am playing catch up, but I\'m to write an awk program to tell the difference, in days, between two dates.

I\'m more or les

5条回答
  •  执笔经年
    2020-12-19 21:27

    I'm sorry. My answer is not about awk, and it is about bash itself. So please don't give a minus for my comment)

    echo -e "00000000" | sed -r 's/^[0]*$/0/g' | sed -r 's/^0[0]+//g'
    

    Or perform integer calculations with (( )) notations

    echo $((0000))
    

提交回复
热议问题