Sample Header Ad - 728x90

awk command to map ASCII char to hex code not working

0 votes
4 answers
621 views
I'm experimenting with awk and I thought it would be a cool idea to write a small program that maps every ASCII char with its hex code. this is what ive done so far: The string is: abshdfitiggwigiwjirjgiejrigjr im keeping it simple and not including returns or tabs etc I've dumped it into a file seperated by commas so that I can use awk's -F flag to recognize them as fields: a,b,s,h,d,f,i,t,i,g,g,w,i,g,i,w,j,i,r,j,g,i,e,j,r,i,g,j,r, And I've done the same for hex dump of the same file: 61,62,73,68,64,66,69,74,69,67,67,77,69,67,69,77,6a,69,72,6a,67,69,65,6a,72,69,67,6a,72,0a, I figured now since they both have the same NF, it would be easier and so I attempted the following awk command: awk -F ',' '{for(i=1;i
Asked by Mathew (243 rep)
Oct 12, 2023, 10:39 PM
Last activity: Oct 13, 2023, 08:03 PM