Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. New post summary designs on greatest hits now, everywhere else eventually. Linked Related Hot Network Questions. Question feed. Stack Overflow works best with JavaScript enabled. Accept all cookies Customize settings. Improve this answer. Matthew Crumley Matthew Crumley Which version of Unix?
I use Linux. If that works, I'll edit the answer. Thank you. I suspected this, but then I fail to make the i command work. I tried inline command without or with -e and script command with -f but I get: sed: rename : Not a directory.
You don't need to edit the answer as long as it is helpful for the asker. Great, but i think you should note the "1i" part, it's not obvious unless you know sed. I think this should be the right answer to the question, cause you did not copy file or make a temporary file , this works will if you have a big file — Medhat. Scottie T Scottie T Hi, this adds to the end of the file - I need it at the beginning - have clarified the question The paradigm is more processing one line at a time you could also programatically find the of fields in the CSV and generate your header line with awk Why not just echo "c1, c2, Sign in Sign up.
Instantly share code, notes, and snippets. Last active Jan 2, Code Revisions 21 Forks 1. Embed What would you like to do? Embed Embed this gist in your website. Share Copy sharable link for this gist. Can anyone please help in modifying the shell script. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Learn more. Shell Script to insert lines in between file Ask Question. Asked 5 years, 7 months ago.
0コメント