Skip to content

Instantly share code, notes, and snippets.

@sebastianwagner
Created June 26, 2013 09:41
Show Gist options
  • Save sebastianwagner/5866164 to your computer and use it in GitHub Desktop.
Save sebastianwagner/5866164 to your computer and use it in GitHub Desktop.
Concatenate CSV files by taking heading first line of first file and appending all non-first-lines of remaining files.
#!/bin/sh
OUTFILE='outfile.csv'
#get header from first line of first file
head -n 1 result*_01_*.csv > "$OUTFILE"
#collect bodies for concatenation and append
tail --silent --lines=+2 result*_*_*.csv >> "$OUTFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment