![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do I search for 2 strings (AND operator) ? | Kartheg | UNIX for Dummies Questions & Answers | 14 | 09-11-2009 04:44 PM |
| problem with grep on search string in a txt file over multiple files | m00 | UNIX for Dummies Questions & Answers | 2 | 05-18-2008 02:21 PM |
| how to search with 2 strings. | syamkp | Shell Programming and Scripting | 2 | 03-10-2008 04:50 AM |
| Search between strings with an OR | pbsrinivas | Shell Programming and Scripting | 3 | 07-12-2007 04:46 AM |
| Search for strings | lesstjm | UNIX for Dummies Questions & Answers | 5 | 04-26-2002 09:58 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Problem to search multiple strings
Hi all,
I am search a string from a file using following command, I want to pick the message ( I.e print $5) from the lookup file if and only if both $hostname and $instancename match. Message=`cat $lookup_tbl| awk '/'$category'/ {if ('$hostname' == '$2' || '$instancename' == '$3') print $5}'` This work fine when I have different category but not with same category. I.e. if $category=interface it work fine but when $category= Link_Availability getting both email id's in category (I.e soman@nvgnoc.com and sudir@nvgnoc.com) my lookup file like this #Look up table############################################################################################### ########### Catagory Hostname Instantname Subject Message E-mail Address interface W2K3GNOC W2K3GNOC2 Message_from_netview W2K3GNOC_link_is_down nvpraveen@nvgnoc.com Link_Availability TVMROUTER TVMROUTER2 Message_from_netview Asianet_Link_is_Down soman@nvgnoc.com Link_Availability TVMROUTER TVMROUTER6 Message_from_netview VSNL_Link_is_Down sudir@nvgnoc.com #################################################################################################### ##################### Please guide me to achieve this. Regards Sudhish |
|
||||
|
Are they real email Ids ? If so please do not furnish such information
You could use something like abc@xyz.com |
|
||||
|
Quote:
only one would be selected, the common second field is ' TVMROUTER ' and the other value should be either ' TVMROUTER2 ' or ' TVMROUTER6 ' so only one row would be selected |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|