Thanks srsjc,
I tested that script & made a slight modification because, when we try to move the file from temp.txt to email.txt, it says the file exists, so I did it this way:
_________________________________
#!/bin/sh
email=$1
mv email.txt email2.txt
egrep -v $email email2.txt > email.txt
rm email2.txt
_________________________________
Now I have a new problem, instead of taking the email address as argument for calling the script, I need to remove the email addresses from this email.txt by taking one email address at a time by reading another file called remove.txt.
The remove.txt file consists of email addresses (one on each line) that need to be removed from email.txt. That is, we are subtracting remove.txt from email.txt.
I understand that the logic for doing this is we need to read one line from remove.txt and then remove it from email.txt and do it until we read all email addresses or lines present in remove.txt. I know how to do it in C or C++ or Java, but not in Shell scripting.
Appreciate a lot if someone could respond to this email.
Thanks in advance,
sbk