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!

Using AWK to find 2 different values in a file

Status
Not open for further replies.

warburp

IS-IT--Management
Oct 27, 2003
44
GB
Hi,
I'm trying to use AWK to find a line in a file equal to 2 different variables and write it to another variable. I can find the values individually but I can't work out how to put them together. Here are the lines:

e=`awk '/ALMHT?/' $DIRLOG$CFILE`
f=`awk '$2 == "Active"' $DIRLOG$CFILE`

I want to then test if the variable is null or not and take action based on that.


Thanks


 
Try something like this:
ef=`awk '($0~"ALMHT?")||($2=="Active")' $DIRLOG$CFILE`
echo "ef='$ef'"

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top