Ok, I can glob() ...
perl -e "use File::DosGlob qw(glob);print glob('test.*')" # works ok!!
but I can not replace (my syntax is incorrect but where) ...
perl -e "use File::DosGlob qw(glob);'s/CONSTANT/VARIABLE/' glob('test.*')" #
does not work -- compilation error ...
??
________________________________
From: Bob McConnell <[email protected]>
To: Tony Esposito <[email protected]>; Shawn H. Corey
<[email protected]>; "Wagner, David --- Senior Programmer Analyst --- CFS"
<[email protected]>
Cc: Beginners Perl <[email protected]>
Sent: Monday, 24 August, 2009 14:39:57
Subject: RE: one liner in Windows to replace string
Windows does not expand the wildcard in your filename like the Unix/Linux
shells do. There is a glob hack that you can use to do that expansion.
Bob McConnell
-----Original Message-----
From: Tony Esposito [mailto:[email protected]]
Sent: Monday, August 24, 2009 3:20 PM
To: Shawn H. Corey; Wagner, David --- Senior Programmer Analyst --- CFS
Cc: Beginners Perl
Subject: Re: one liner in Windows to replace string
I am happy that it works with double quotes BUT now, when I try to get all
files in a directory with a certain extension, the following does not work ...
perl -p -i.bak -e "'s/CONSTANT/VARIABLE/'" C:\*.txt
does not like th leading * in the file name when I try to pull all .txt files
...
Help again.
________________________________
From: Shawn H. Corey <[email protected]>
To: "Wagner, David --- Senior Programmer Analyst --- CFS"
<[email protected]>
Cc: Tony Esposito <[email protected]>; Beginners Perl
<[email protected]>
Sent: Monday, 24 August, 2009 12:57:27
Subject: Re: one liner in Windows to replace string
Wagner, David --- Senior Programmer Analyst --- CFS wrote:
> I ran under windows with what Tony sent, both the cmd and a korn
> shell and both worked and updated as expected..
>
> If you have any questions and/or problems, please let me know.
> Thanks.
What version of Windows? The last time I used Windows was XP and it would see
single quotes as:
perl -p -i.bak -e "'s/CONSTANT/VARIABLE/'" C:\test.txt
which, of course, don't work.
-- Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
I like Perl; it's the only language where you can bless your
thingy.
-- To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/