[CentOS] perl one-liner issue

Thu Mar 17 10:15:33 UTC 2011
John Doe <jdmls at yahoo.com>

From: Joseph L. Casale <jcasale at activenetwerx.com>

> To: "centos at centos.org" <centos at centos.org>
> Sent: Wed, March 16, 2011 8:56:41 PM
> Subject: [CentOS] perl one-liner issue
> 
> I am trying to deduce the one liner for an rpm I am packaging to edit a  php
> configuration file from within my spec. The line I am editing looks  like:
> $conf['nagios_base'] = "/nagios/cgi-bin";

A sed alternative:

  sed -i '/nagios_base/ s/\/nagios\/cgi-bin/xxx/' $FILE
or more selective:
  sed -i '/$conf\[.nagios_base.\] = / s/\/nagios\/cgi-bin/xxx/' $FILE

JD