I have a file named.conf, here first i need to find himanshu.com and then extract the corresponding zone file i.e. for1 , I don't know what parameters would be passed to the awk script to find pattern two lines below.
named.conf
options {
directory "/var/named";
};
zone "himanshu.com" in {
type master;
file "for1";
};
zone "0.168.192.in-addr.arpa" in {
type master;
file "rev";
};
grep -A2 himanshu.com named.conf|awk '{print $2}-A2shows 2 lines below/after matching, not the 2nd line below matching.fileline might not be exactly 2 below thezoneline. If this were true, you could dogrep -A2 himanshu.com named.conf | grep file | cut -d\" -f2