Skip to content

Instantly share code, notes, and snippets.

@tayeke
Created March 3, 2021 06:51
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 tayeke/7cc0aebd13b168fb16ca7406cf0c0268 to your computer and use it in GitHub Desktop.
Save tayeke/7cc0aebd13b168fb16ca7406cf0c0268 to your computer and use it in GitHub Desktop.
Splits extremely large CSVs into smaller CSVs by a common date format match using awk
#!/usr/bin/awk -f
#use BEGIN sepecial character to set FS built-in variable
BEGIN {
FS = ","
}
{
# split DD/MM/YYY into an array of values
date_string = substr($5, 2, 10)
file = "exports/activity-"date_string".csv"
print $ROW > file
}
END {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment