Skip to content

Instantly share code, notes, and snippets.

@WagnerMatos
Created April 24, 2015 08:13
Show Gist options
  • Save WagnerMatos/279a8afacee5c61e2c8e to your computer and use it in GitHub Desktop.
Save WagnerMatos/279a8afacee5c61e2c8e to your computer and use it in GitHub Desktop.
Split a cvs file in many parts
tail -n +2 file.txt | split -l 4 - split_
for file in split_*
do
head -n 1 file.txt > tmp_file
cat $file >> tmp_file
mv -f tmp_file $file
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment