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