Could you guys help me out of this problem... I need to send an email to all the users and the email has to be picked from the text file.
text file contains the no. of records like:
Every four lines make one record. For example consider the first record. I need to send a mail to giridhar276@gmail.com containing the his details "giridhar,224285,847333".
Now the details in the second record(next four lines) has to be sent to venkata.ramana@gmail.com
Like wise I need to send an email to other users alsooo......
My requirement is to send only his details to his user id.. But I was unable to do that.......
Here, I was reading each line and storing every 4th line and sending all other details as well(but it's not my requirement).
I has to send only his particular details as I mentioned....
cat myfile.txt | while read line
do
count=`expr $count + 1`
if [ `expr $count % 4` != 0 ]
then
mail -s "Please check your details" $line < mytext.txt
fi
done
Don't forget the input file. Note that this method is more efficient than cat'ing the file and piping it to the while loop (you might get a useless use of cat award reconstruction of the Award text. One less process needed. There are some other good tips on that page too.