sed - Can I use awk to specify in which column to place string? -


i have tab separated text file called test.txt multiple columns i'm trying make identical file called output.txt.

the test.txt looks follows

    t   m  sx  sy  sz  rx   ry   rz  49.07   0   -1.00   0.00   -0.11   20.00   0.00   -2.18  49.47   0   -1.00   0.00   -0.11   22.00   0.00   -2.33  50.89   0   -1.00   0.00   -0.11   34.00   0.00   -3.21  . :  42.06  0    29.00   0.00   -2.86   12.00   0.00   -1.44 

the problem that, no matter type of delimiter use, still not have same form desired output file called output.txt

in output.txt, these columns have specific location,

    t        m     sx      sy        sz      rx       ry     rz ln1,col1    ln1,col9    ln1,col17    ln1,col25    ln1,col33  ln1,col41  ln1,col49 ln1,col57  

i'm bit new awk, sed , of other unix commands. suggestion?

have tried this?

awk -f 'begin{print "t\tm\tsx\tsy\tsz\trx\try\trz"}{print $1"\t"$9"\t"$17"\t"$25"\t"$33"\t"$41"\t"$49}' test.txt 

you print header @ beginning , each line print desired columns


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -