Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use pipe to send email to $3 in a awk script

Status
Not open for further replies.

hk08904

Programmer
May 17, 2002
1
US
Hi, everybody,

Now I have a file1 including:
fname:lname:email address(like xxxx@yahoo.com)

I want to email all users a message, the message is saved in file2.

I wrote:
nawk 'BEGIN{ FS=":"; n=1;
while (getline < &quot;file2&quot; > 0)
form[n++]=$0 }
{ print &quot;Dear &quot;$1,$2&quot;:&quot; | &quot;mail $3&quot;
for ( i=1; i<n; i++)
{ msg=form
print msg | &quot;mail $3&quot; }
}' $file1

But &quot;mail $3&quot; doesn't work.
How can I pass the value of $3 into unix command in the awk script.

Could any body help me.

Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top