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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

awk help

Status
Not open for further replies.

Martin999

Technical User
Feb 26, 2004
298
US
Hi guys, could someone help me ...

Got a function, see below, I would like to search using the line

" if (/warning/ || /error/ || /emer/) "

I was hoping that the || would mean OR, but not appearing to work.

Anyhelp greatfully received.

Martin

grep "loading volume" $(echo $DAEMONLOG) | ${AWKPATH}/awk '{print $NF}' | sort -u |sed -e "s/:\\\\/.*/" |while read TAPE

do

grep $TAPE $(echo $DAEMONLOG) | ${AWKPATH}/awk '{

if(/[AP]M .*loading volume/){

vol=$9;

}else {if(/loading volume/){vol=$8}}
#Extra if statement (above) due to bug in Networker where date can occasionlly appear in 12 hr format
#and produce an extra field (AM/PM)
if (/warning/ || /error/ || /emer/){


print vol,$0;

}

}'

done |sed -e "/^[ ].*/d" >&3
 
Thanks, that's what I thought, will take another look.

Martin
 
And what about this ?
if (/warning|error|emer/){

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV, will give that a go also.

Mine is now working, he he , bit stupid of me, the file I was testing on only contained one of the strings I was searching for ... :eek:)

M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top