Created
March 3, 2021 06:51
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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