Skip to content

Instantly share code, notes, and snippets.

@whyvez
Created June 5, 2015 13:04
Show Gist options
  • Select an option

  • Save whyvez/fcdacf015cee8ec694c2 to your computer and use it in GitHub Desktop.

Select an option

Save whyvez/fcdacf015cee8ec694c2 to your computer and use it in GitHub Desktop.
pgyi swap ds company
COMPANY=TSI; mkdir -p $COMPANY; for csv in *.csv; do awk -F, -v COMPANY=$COMPANY 'NR > 1 {OFS=","; $1=COMPANY}1' $csv > ./$COMPANY/$csv; done
@whyvez
Copy link
Copy Markdown
Author

whyvez commented Jun 30, 2015

usage: cd into a directory that has csv files with a company field and run.
outcome: will create a new directory for the $COMPANY passed in that contains the same csv file with the company changed to $COMPANY. TSI in this case

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