Get number after zeros

I need to get 88090000 after zeros. How can I do this with awk?

The number can be any number of zeros. But I need a number after zeros.

0000000088090000 

I appreciate your help.

+4
source share
4 answers

Just add 0.

 $ awk '{ print $0 + 0 }' <<< '0000000088090000' 88090000 
+4
source

Using regular expressions:

 echo '0000000088090000' | awk '{ sub(/^0+/, ""); print }' 
+4
source

One of the methods:

 echo "0000000088090000" | awk '{ printf "%d\n", $0 }' 
+1
source

Using sed:

 [jaypal:~/Temp] echo "0000000088090000" | sed 's/^0\+//g' 88090000 
+1
source

Source: https://habr.com/ru/post/1388213/


All Articles