On Mon Aug 24 2009 @  4:45, Tony Esposito wrote:
> perl -p -i.bak -e 's/CONSTANT/VARIABLE/' C:\test.txt
> 
> Trying to replace a string with this one line perl ... in Windows it does not 
> seem to work ...
> 
> File test.txt contents is ...
> 
> CONSTANT 100
> CONSTANT 200
> 
> nothing changes ... acts as if it does not 'see' the CONSTANT string.
> 
> Help because it looks like it should work !!!

I don't use Windows, but my first thought is that it's a quoting problem.
Try replacing the single-quotes with double-quotes in the command line:

perl -i.bak -ple "s/CONSTANT/VARIABLE/" C:\test.txt

See here for more one-liner tips: http://sial.org/howto/perl/one-liner/

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


        • Re: one l... Tony Esposito
          • RE: o... Bob McConnell
            • ... Tony Esposito
          • Re: o... Shawn H. Corey
            • ... Tony Esposito
              • ... Telemachus
              • ... Shawn H. Corey
              • ... Wagner, David --- Senior Programmer Analyst --- CFS
          • RE: o... Wagner, David --- Senior Programmer Analyst --- CFS
        • RE: one l... Wagner, David --- Senior Programmer Analyst --- CFS
  • Re: one liner in Windo... Telemachus
  • RE: one liner in Windo... Wagner, David --- Senior Programmer Analyst --- CFS

Reply via email to