Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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