Skip to content

Instantly share code, notes, and snippets.

@cuevasclemente
Created March 21, 2016 17:52
Show Gist options
  • Save cuevasclemente/7a784d78f6684fe07563 to your computer and use it in GitHub Desktop.
Save cuevasclemente/7a784d78f6684fe07563 to your computer and use it in GitHub Desktop.
Shell one-liner to: Get the first row of a bunch of CSV files (ostensibly headers) and write them all to the same file, but with the first element of that file being the name of the file without `csv`
$ for file in *.csv; do echo "${file%.csv},$(head -n 1 $file)" >> headers; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment