1831320 Members
3009 Online
110023 Solutions
New Discussion

Script

 
SOLVED
Go to solution
hpuxsa
Frequent Advisor

Script

Hi,
Could some one help me on this please. Here are three lines from my text file. I would like to sent a mail for each line with body of the mail being the line itself.

ALARM 438 01/SW_DEV "BSC21C0018A07E0"A 020925 0850 DIGITAL PATH QUALITY SUPERVI
SION
ALARM 793 01/SW_DEV "BSC41C0018A07E0"A 020925 0815 DIGITAL PATH QUALITY SUPERVI
SION
ALARM 796 01/SW_DEV "BSC41C0018A07E0"A 020925 0830 DIGITAL PATH QUALITY SUPERVI
SION

I mean sending mails per line. Hope it is clear.

Thanks & Rgds,
Gen.
2 REPLIES 2
Sridhar Bhaskarla
Honored Contributor
Solution

Re: Script

Hi Gen,

You can do this way

cat file |while read line
do
ALARM=`echo $line|awk '{print $1,$2}'`
echo $line |mailx -s "$ALARM" your_mailid
done

-Sri

You may be disappointed if you fail, but you are doomed if you don't try
James R. Ferguson
Acclaimed Contributor

Re: Script

Hi:

Here's one way:


# MAILMSG=/tmp/msg.$$
# while read LINE
> do
> echo $LINE > ${MAILMSG}
> mailx -s "Alert!" root < ${MAILMSG}
> done < yourfile
# rm ${MAILMSG}

Regards!

...JRF...