Created
April 25, 2018 14:26
-
-
Save kalinchernev/464cfbdfdfd30549efbaa3d369946d58 to your computer and use it in GitHub Desktop.
split csv file into several files by a given number of items, head row is preserved
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
#!/bin/sh | |
tail -n +2 activity.csv | split -l 8000 - split_ | |
for file in split_* | |
do | |
head -n 1 activity.csv > tmp_file | |
cat $file >> tmp_file | |
mv -f tmp_file "$file.csv" | |
rm $file | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment