![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-19-2007 09:52 PM |
| Unix masters please help newbie on "find" command | white_raven0 | UNIX for Dummies Questions & Answers | 2 | 09-26-2005 09:54 PM |
| directory named "-filedir" | jskillet | UNIX for Dummies Questions & Answers | 2 | 09-22-2004 04:25 PM |
| Directory named "~" that points to root | jskillet | SUN Solaris | 1 | 08-06-2004 09:23 AM |
| better information source than "man rc.conf"? | xyyz | UNIX for Dummies Questions & Answers | 1 | 03-01-2003 05:42 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Parse "masters" ip from named.conf
Hi there, Im' trying to make a script to parse the BIND configuration file from my slave DNS server and obtain a certain parameter. The named.conf file has this format:
Code:
zone "0.170.20.10.in-addr.arpa" {
type slave;
file "0/./db.0.170.20.10.in-addr.arpa.bak";
allow-notify { 172.16.1.208; };
masters {
172.16.1.208;
};
};
zone "180.20.10.in-addr.arpa" {
type slave;
file "1/8/db.180.20.10.in-addr.arpa.bak";
allow-notify { 172.16.1.208; };
masters {
172.16.1.208;
};
};
zone "0.180.20.10.in-addr.arpa" {
type slave;
file "0/./db.0.180.20.10.in-addr.arpa.bak";
allow-notify { 172.16.1.208; };
masters {
172.16.1.208;
};
};
The closest I've got is Code:
nawk '/zone "180.20.10.in-addr.arpa"/,/[000-999].[000-999].*;/' /opt/bind/etc/named.conf Any idea will be welcome |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
Code:
nawk '/zone "180.20.10.in-addr.arpa"/,/^};/{ if ($0 !~ /[^ .0-9;]/) print }' /opt/bind/etc/named.conf
|
|
|||
|
And thanks to era's help, here is the code!
Code:
nawk '/zone "180.20.10.in-addr.arpa"/,/^};/{ if ($0 !~ /[^ .0-9;]/) print }' /opt/bind/etc/named.conf |sed 's/^[ \t]*//;s/\;//'
Thank you very much! |
|||
| Google UNIX.COM |