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 <r...@cbord.com>
To: Tony Esposito <tony1234567...@yahoo.co.uk>; Shawn H. Corey 
<shawnhco...@gmail.com>; "Wagner, David --- Senior Programmer Analyst --- CFS" 
<david.wag...@fedex.com>
Cc: Beginners Perl <beginners@perl.org>
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:tony1234567...@yahoo.co.uk] 
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 <shawnhco...@gmail.com>
To: "Wagner, David --- Senior Programmer Analyst --- CFS" 
<david.wag...@fedex.com>
Cc: Tony Esposito <tony1234567...@yahoo.co.uk>; Beginners Perl 
<beginners@perl.org>
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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


      

Reply via email to