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!

NAWK script

Status
Not open for further replies.

sethu

Programmer
Apr 15, 2000
29
US
Hi Gurus,

I need a help with NAWK script. The functionality I am trying to achieve is this. I have a log file from which I want to do a search on a word say 'TEST-SUCCESS' and email a user when it finds it. Your immediate response is highly appreciated.
 
Hi, sethu!

You can try this awk command:

awk '/TEST-SUCCESS/ { print | mail user; exit }' logfile

This awk script finds the line with pattern TEST-SUCCESS, email entire line to user and exits.

I didn't test this program solution, but I hope it helps.

Bye!

KP.
 
BTW, commands 'mail user' must be enclosed between the
double quotes: "mail user". Bye! KP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top