Is it possible by using awk to remove leading zeros for a hex number?
ex:
0000000011179E0A -> 11179E0A
Thank you!
Is it possible by using awk to remove leading zeros for a hex number?
ex:
0000000011179E0A -> 11179E0A
Thank you!
$ echo 0000000011179E0A | awk '{print gensub(/^0*/,"","")}'
11179E0A
$ echo 0000000011179E0A | ruby -e 'print gets.sub(/^0*/,"")'
11179E0A
Convert to base 10 using bash/ksh base conversion and back to hex with printf:
$ printf "%X" $((16#0000000011179E0A))
11179E0A
Edit: Beware - After more testing of the above I found it dosn't work real well with big hex numbers (particularly if first hex digit is > 8), probably best to use string functions to remove the zeros:
$ echo 0000000011179E0A | sed 's/^0*//'
11179E0A
echo "0000000011179E0A" | sed 's/^0*//'