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/