mofo has asked for the wisdom of the Perl Monks concerning the following question:
open(FD,"+< named.conf"); $domain="domain.com"; while(<FD>) { if (/^zone \"$domain\" \{/ .. /\}\;/) { print; #show me that config block } } close(FD);
open(FD,"+< named.conf"); $domain="domain.com"; while(<FD>) { if ($_ !~ /^zone \"$domain\" \{/ .. /\}\;/) { print; #show me everything but what I asked for push (@outtext,$_); #put it away for later use } } close(FD);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Removing lines from a file.
by buckaduck (Chaplain) on Apr 18, 2001 at 01:24 UTC | |
by mofo (Acolyte) on Apr 18, 2001 at 06:02 UTC | |
|
(ar0n: BIND::Conf_Parser) Re: Removing lines from a file.
by ar0n (Priest) on Apr 18, 2001 at 00:29 UTC | |
by mofo (Acolyte) on Apr 18, 2001 at 00:36 UTC | |
|
Re: Removing lines from a file.
by arturo (Vicar) on Apr 18, 2001 at 00:41 UTC | |
|
Re: Removing lines from a file.
by Albannach (Monsignor) on Apr 18, 2001 at 01:07 UTC | |
|
Re: Removing lines from a file.
by michellem (Friar) on Apr 18, 2001 at 00:47 UTC |