Skip to content

Instantly share code, notes, and snippets.

@adilapapaya
Last active August 29, 2015 14:07
Show Gist options
  • Save adilapapaya/cf9f15bc94eac841a006 to your computer and use it in GitHub Desktop.
Save adilapapaya/cf9f15bc94eac841a006 to your computer and use it in GitHub Desktop.
Helpful Terminal Commands

Find all files named _somethingsomething_ yy _somethingsomething_ .csv in all folders named xx and get all of the data from the second row of each file.

cat "`find . -type d -iname "xx" | find . -type f -iname "*yy*csv" | head -1`" | sed -n 1p  > SummaryOfYY.csv; 
find . -type d -iname "xx" | find . -type f -iname "*yy*csv" -exec sed -n 2p {} \; >> SummaryOfYY.csv

The first line above gets the header from the first file. The second line above grabs the second row from the files and adds it to the SummaryOfYY.csv file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment