You forgot the i to ignore case. You have This w/ s/this/that/g and need the i.

Wags ;)

-----Original Message-----
From: Steve Harper [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 13, 2002 15:04
To: [EMAIL PROTECTED]
Subject: Search and replace one-liners in ActivePerl broken?


Can someone please tell me why the following doesn't work?  Observe:

In Windows 2000 CMD.exe, with ActiveState Perl 5.6.1 Build 631
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\>copy con testtextfile.txt
This is this, that is that
Thats all folks!
^Z
        1 file(s) copied.

D:\>perl -pi.bak -e 's/this/that/g' testtextfile.txt

D:\>md5sum test*
ca08d1da587bff5a25bb33f22fa62df7 *testtextfile.txt
ca08d1da587bff5a25bb33f22fa62df7 *testtextfile.txt.bak

D:\>rm *.bak
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Now, lets try that in Cygwin w/ it's perl v5.6.1...

Administrator@PSIONIC /cygdrive/d
$ perl -pi.bak -e 's/this/that/g' testtextfile.txt

Administrator@PSIONIC /cygdrive/d
$ md5sum test*
74d5c5e10b51b882fa5438a4f99cc111 *testtextfile.txt
ca08d1da587bff5a25bb33f22fa62df7 *testtextfile.txt.bak

Administrator@PSIONIC /cygdrive/d
$
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I'm fairly perplexed by this difference in behaviour, I've read a fair
amount in the documentation to try to figure this out, but nothing I've
seen has really answered my question.  I'm sure its something stupid, like
shell differences, but it seems like the perl runtime is getting
everything it needs here and is still not making the changes to the file.

Thanks in advance for any help on this.

Steve Harper
Software Developer
Campus Student Computing
University Of Utah

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to