Created
August 17, 2015 14:28
-
-
Save groggu/d804e149943d73f8c56a to your computer and use it in GitHub Desktop.
Great script to split up large CSV files into parts. Change the term "filename" below to be the csv file name and change the 25000 to be the number of lines in each split file.
This file contains 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
tail -n +2 filename.csv | split -l 25000 - filename_ | |
for file in filename_* | |
do | |
head -n 1 filename.csv > tmp_file | |
cat $file >> tmp_file | |
mv -f tmp_file $file.csv | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment