Skip to content

Instantly share code, notes, and snippets.

@equivalentideas
Created June 7, 2017 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save equivalentideas/070e7be07985cabbad5334fb6b7f5bf2 to your computer and use it in GitHub Desktop.
Save equivalentideas/070e7be07985cabbad5334fb6b7f5bf2 to your computer and use it in GitHub Desktop.
Bash script for dividing emails.txt into separate .csv files for each 2000 email addresses
line_count=$(cat emails.txt | wc -l)
file_count=0
while [ $file_count -lt $line_count ]
do
echo "creating file emails_$file_count.csv"
tail -n+$file_count emails.txt | head -n2000 >> emails_$file_count.csv
file_count=$[$file_count+2000]
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment