can't search and replace

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • badbird
    New Member
    • Feb 2008
    • 3

    can't search and replace

    Hi,

    Can anyone help? I try search the keyword from _V and replace _VDR at the create.bat file and use below perl command but it doesn't work.

    perl -pi -i.bak -e 's/_V/_VDR/' create.bat


    After execute the above command and all _V not change to _VDR :
    rmtshare \\NASP01\GRP_Ne twrkOps = "c:\vol\IA01_V0 01\GRP_NetwrkOp s" /REMARK:"Network Operation"


    Best regards,

    Chung
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    try removing the i that is right after p in the oneliner you posted and add the "g" modifier to the regexp:

    Code:
    perl -p -i.bak -e 's/_V/_VDR/g' create.bat
    make sure to use the full path to create.bat if necessary

    Comment

    • badbird
      New Member
      • Feb 2008
      • 3

      #3
      Hi KevinADC,

      Thanks your reply, but it still not change after try your solution.


      Best regards,

      Chung

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Works for me. Don't know what to tell you.

        Comment

        • badbird
          New Member
          • Feb 2008
          • 3

          #5
          Hi KevinADC,

          I don't install perl at windows and just only Perl300.dll, Perl.exe and PerlMsg.dll files. Is any missing? Thanks.


          Best regards,

          Chung

          Comment

          • KevinADC
            Recognized Expert Specialist
            • Jan 2007
            • 4092

            #6
            Originally posted by badbird
            Hi KevinADC,

            I don't install perl at windows and just only Perl300.dll, Perl.exe and PerlMsg.dll files. Is any missing? Thanks.


            Best regards,

            Chung
            As far as I know you need to install perl. I do not know what perl300.dll is or PerlMsg.dll. perl.exe looks like the main perl executable but there are many other files that come with perl.

            Comment

            Working...