Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Could you please tell us what's wrong with applying the solution to the first link here? (And write the headers out first or later.) Commented Feb 9, 2017 at 12:50
  • 1
    As a general rule (and my answer there is no exception) awk is fine if you're working with simple csv files (i.e. there are no delimiters embedded in the fields); if you're dealing with more complex csv files my advice is to use a proper tool (e.g. perl, python etc) Commented Feb 9, 2017 at 12:52
  • @Sparhawk Adding content at the top of files is at the very least tedious, especially if you have to do it thousands of times. Automation is best. Commented Feb 9, 2017 at 12:55
  • @don_crissti Yes, definitely. I simply thought this would be a very common case where shell tools could be a simple solution. I've certainly had to do this several times in different contexts. Commented Feb 9, 2017 at 12:55
  • @don_crissti Would you be interested in writing an answer with an example script which handles less regular input? Commented Feb 9, 2017 at 18:20