5 1 | I want to add a row of headers to an existing CSV file, editing in place. How can I do this?
and I want to end up with
(nb changing the initial CSV output is out of my hands) EDIT: I originally had this as 'using sed' but any standard command will do. The important thing is the file is edited in place, and the line is inserted at the beginning of the file. Thanks,
| |||
15 | To answer your original question, here's how you do it with sed:
The "1i" command tells sed to go to line 1 and insert the text there. The -i option causes the file to be edited "in place" and can also take an optional argument to create a backup file, for example
would keep the original file in "testfile.csv~". | ||||||||||
|
linux - How can I add a line to a file in a shell script? - Stack Overflow
'via Blog this'
Connie O'Dell - Dv, Eda, Jobseeking, Life,Whatever: How Can I Add A Line To A File In A Shell Script (With Sed)? - Stack Overflow >>>>> Download Now
ReplyDelete>>>>> Download Full
Connie O'Dell - Dv, Eda, Jobseeking, Life,Whatever: How Can I Add A Line To A File In A Shell Script (With Sed)? - Stack Overflow >>>>> Download LINK
>>>>> Download Now
Connie O'Dell - Dv, Eda, Jobseeking, Life,Whatever: How Can I Add A Line To A File In A Shell Script (With Sed)? - Stack Overflow >>>>> Download Full
>>>>> Download LINK