Skip to content

Instantly share code, notes, and snippets.

@willycs40
Created April 15, 2015 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willycs40/f12e4b5051d1d8591e26 to your computer and use it in GitHub Desktop.
Save willycs40/f12e4b5051d1d8591e26 to your computer and use it in GitHub Desktop.
Using Cygwin to combine csvs
# Get the row names and put them in a new file called combined.csv
head -4 firstFile.txt | tail -1 > combined.csv
# Get the data from all files and append to combined.csv
# The more complicated 'find, while, do, done' is there because my file names had spaces in
find ./*.txt | while read file; do awk 'NR>5' "$file"; done >> combined.csv
# Finally do a row count reconcilisation
wc -l *.txt && wc -l combined.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment