mailsrikanth007 has asked for the wisdom of the Perl Monks concerning the following question:

Hi Experts,

I am trying to substitute set UNIT_NAME "" with set UNIT_NAME "DESIGN" using perl command line. I tried

perl -pi -e "s/UNIT_NAME \"\"/UNIT_NAME \"DESIGN\"/g;"

However it wouldn't work. It returns with Unmatched " :(

Could someone help me out please!

Replies are listed 'Best First'.
Re: help substitute between quotes
by Kenosis (Priest) on Jan 23, 2014 at 04:39 UTC

    The following worked in Linux:

    perl -pi.bak -e 's/(?<=UNIT_NAME )""/"DESIGN"/g'

    And this in Windows using cmd.exe (even though the escaped quotes are like yours):

    perl -pi.bak -e "s/(?<=UNIT_NAME )\"\"/\"DESIGN\"/g"

      Thanks for the reply!! It worked.

        You're quite welcome!

Re: help substitute between quotes
by Anonymous Monk on Jan 23, 2014 at 04:52 UTC