awk - convert a 15 digit number to hex -


I need to input a 15 digit numerical input for a different hex string than a comma, but I started it Can not seem to get it for the first character, which I have so far received:

  echo "012345678912345" | Awk 'BEGIN {FS = OFS = ""} {for (i = 1; i & lt; = nf; I ++) {if (i% 1 == 0) $ i = $ i ", 0x3"}} 1 '0,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x31,0x32,0x33, 0x34,0x35,0x3 echo 123456789123456 | Awk '$ 1 = $ 1' FS = OFS = ", 0x3" 1,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x31,0x32,0x33,0x34,0x35,0x36  < / Pre> 

How can I insert 0x3 initially or initially add a random character, then delete it later? The expected result ID will be from the input of 012345678912345:

  0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x31,0x32,0x33,0x34, 0x35  

  awk -v OFS = ", 0x3" -v fs = your example With: "$ 1 =" 0x3 "$ 1"  

  $ echo "012345678912345" | Awk -v OFS = ", 0x3" -us FS = "" '$ 1 =' 0x3 "$ 1 '0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x31,0x32,0x33 , 0x34,0x35  

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -