I want to write script in order to split a file into small pieces and send it automatically through mail.
Ex. The file name is CALM*.txt . It is around 50 MB. I want to split the file into 20 MB 2-3 smaller files and send (like uuencode) it to some user (like piyush@unix.com)
assuming the file is a text file, use split to make smaller files, depending upon the average line length, about 25000, 40 character lines per megabyte.
mkdir output
cd output
split -l1000000 ../inputfile
list=`ls x*`
count=1
for file in $list
do
mutt -a $file -s "Part $count" emailaddress
count=`echo $count + 1|bc`
done
Changed the line that was list=`ls` to list=`ls x*` so that this script is not part of the emails