Charles,

On (Mon, Aug 04 19:01), Charles Johnson wrote:
> I can change the -1 to 500 with:
> 
> $config=~s/-1/500/;
> 
> What I'd really like to do is change either -1 or 0 in the MaxBytes 
> line to 500 with one statement.

$config =~ s/(?:-1|0)$/500/m;

You should probably make sure you are changing the MaxBytes line instead of the 
first -1 or 0 that you encounter.

e.g.:

my $config=<<'MRTG_CONFIG';
...
MaxBytes[kontor.cpu]: -1
...
MRTG_CONFIG

$config =~ s/(MaxBytes[^:]+:) (?:-1|0)$/$1 500/m;

This should print:
MaxBytes[kontor.cpu]: 500

HTH,
Todd

--
Unsubscribe mailto:[EMAIL PROTECTED]
Help        mailto:[EMAIL PROTECTED]
Archive     http://www.ee.ethz.ch/~slist/mrtg-developers

Reply via email to