change to columns and remove columns csv shell -


i have csv file containing several hundred lines of data. want able insert line on top remove columns has name data , put name of data on top of data value column. , convert text columns delimited space. looking have done in shell. see before , after exp below.

before: 1 line of data

work_needs_to_get_done_001 time 25000000 runs 28908331 other_data1 89708097    work_needs_to_get_done_002 time 25000000 runs 27285458 other_data1 89708097    work_needs_to_get_done_003 time 25000000 runs 27284897 other_data1 89708097   work_needs_to_get_done_004 time 25000000 runs 27280741 other_data1 89708097 

after: individual columns delimited space

workname                   time     runs      other_data1   other_data2  work_needs_to_get_done_001 25000000 28908331  89708097      89708097   work_needs_to_get_done_002 25000000 27285458  89708097      89708097 work_needs_to_get_done_003 25000000 27284897  89708097      89708097 work_needs_to_get_done_004 25000000 27280741  89708097      89708097 

when need treat columns comes, think of using :

awk '{print $1, $3, $5, $6}' file 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -