NDeveloper NDeveloper - 2 months ago 5
Linux Question

Shell Script to print row value of a particular index

I have a output like following:

S0 S1 E O P YGC YGCT FGC FGCT GCT LGCC GCC
31.59 0.00 20.69 44.69 59.67 8296 14.909 129667 621.433 636.342 CMS Final Remark No GC


Now I need to pick particular key and value and print like:

S0,P,FGCT
31.59,59.67,621.433


how to pick particular index value in each row?
Please suggest

igr igr
Answer

One way can be

awk '{ print $1 " " $5 " " $9 }' MyFileName

or if in some variable

echo $MyContent | awk '{ print $1 " " $5 " " $9 }'

EDIT: Not sure I got the context correctly...

Comments