From: "Xavier Noria" <[EMAIL PROTECTED]>> On Sat, Jun 14, 2008 at 9:56 AM,
Octavian Rasnita <[EMAIL PROTECTED]> wrote:
Is there a one-liner command that can replace a certain text with another
in
more files specified with wildcards like *.html that works under Windows
cmd?
Since you ask this you probably know the Windows shell does not expand
wildcards. There's a trick for Perl one-liners though (untested):
perl -e "@ARGV = glob(qq($ARGV[0])); s/foo/bar/ while <>"
You see the idea.
Thank you but I don't think it works without writing a full perl program in
a single line that does that.
If I just replace the string in $_, the files are not updated.
If I also use -pi.bak parameter in order to do that, it gives an error
telling that the specified file (*.txt) can't be opened.
So I can't see another solution than opening the files, making the
replacement than writing the new content.
Thank you.
Octavian
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/