Hi all,

In comp.unix.shell Alan Murrell posted this clever sed solution for removing 
entries from his named.conf file using only the domain name):

sed '/zone "domain.com" {/,/};/d' /etc/named.conf > newfile

Instead of using actual line numbers for the range of lines (such as "1,4") 
he uses two regexes that match to them.

How might one do this in Perl? Read in the whole file and then do a 
multi-line substitution? 

Or a 'bigger' solution would be to read the lines one at a time into a hash 
structure ($domain{domain.com} for ex.), starting a new hash key each time 
one matches /^\s*zone.*/ ? This would then let one sort, do whatever, and 
write out the entire file afterwards in proper format.

No solution needed, just wondering about approaches (small and large).

-K

__DATA__
zone "domain.com" {
    type master;
    file "domain.com";
};
zone "domain2.com" {
    type master;
    file "domain2.com";
};
##


-- 
Kevin Pfeiffer
International University Bremen

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to