5

print a file in hex using awk

view full story
linux-howto

http://unix.stackexchange.com – I have a file name x $ cat x 1A34532112345 I wants to print in hex using awk I written a script (with help from web) fold -1 /home/cscape/Desktop/x | gawk '{ printf("%s , %X\n",$0, int($0) )}' But output for each char is 0 $ fold -1 /home/cscape/Desktop/x | gawk '{ printf("%s , %X\n",$0, int($0) )}' 1 , 1 A , 0 3 , 3 4 , 4 5 , 5 3 , 3 2 , 2 1 , 1 1 , 1 2 , 2 3 , 3 4 , 4 5 , 5 Why 0 for A. even with %d. I wants to print ASCII value of A as HEX. (HowTos)