Last active
January 18, 2019 05:55
-
-
Save anroopak/e596e6aa250d681f79498bd694510402 to your computer and use it in GitHub Desktop.
Script to split CSV files to small chunks
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
# Credit: https://stackoverflow.com/a/53269966/2594980 | |
csvheader=`head -1 bigfile.csv` | |
split -d -l10000 bigfile.csv smallfile_ | |
find .|grep smallfile_ | xargs sed -i "1s/^/$csvheader\n/" | |
sed -i '1d' smallfile_00 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment