Hi,
I am trying to get an ouput of certain fields from a file:
awk '{ print $NF }' portfile
8087
8047
localhost:1117
Now i need to take this output and see if it exists in netstat -a command. How do i check that.
Thanks,
Gundu
Hi,
I am trying to get an ouput of certain fields from a file:
awk '{ print $NF }' portfile
8087
8047
localhost:1117
Now i need to take this output and see if it exists in netstat -a command. How do i check that.
Thanks,
Gundu
Hi Gundu. Try this:
LIST="`awk '{ print $NF }' portfile`"
if netstat -a |egrep -s "$LIST"
then
echo "do this"
else
echo "do that"
fi
Hope this helps.
Thank you very much, it worked as expected
You're welcome.