Wednesday 15 August 2012

How to edit a particular column in csv file with unix command? -


I want to write a script that will add daily in a new CSV sheet daily.

The script runs daily and will be attached to the CSV file. How to edit the CSV file now? Edit will be through awk or sed commands I will use this CSV file to send mail to users and it will be used in Excelsets.

I have not received any relayant agents from all the questions, so please try to answer it.

You can try something with awk :

  awk 'BEGIN {FS = OFS = ","} {$ NF = $ NF ", New_stuff"} 1' csv   

  $ cat csv1, shoes, red 2, apple, black 3, fog, blue 4, elephant, gray 5, monkey, green $ agent 'BEGIN {fs = os = ","} {$ nf = $ nf ", New_stoff"} 1 'csv1, shoe, red, new_stuff2, apple, black, newestast 3, fog, blue, new_stuff 4, elephant, gray, new_stuff 5, monkey, green, new_stoff    

No comments:

Post a Comment