VAR="10.101.10.5"
I have a text file abc.txt in the below format:
Name : www.ayz.com { Destination : 10.101.10.2 tcpmask members { 10.101.10.5 :http { address 10.101.10.5 } 10.101.10.3 :http { address 10.101.10.3 } }
Name : www.abc.com { Destination : 10.101.10.5 tcpmask members { 10.101.10.5 :http { address 10.101.10.5 } 10.101.10.3 :http { address 10.101.10.3 } }
The requirement is when I grep for a specific IP for example 10.101.10.5
. It should the search only the line which has the IP 10.101.10.5
after the word Destination and before the word members.
So basically I need a command which just lists the second line only when I grep for 10.101.10.5
, it should not return first line because it has IP after members.
I tried using sed
but it's not helping:
sed -n '/destination : $VAR /,/<members>/p' /abc.txt