On approximately 1/29/2004 5:59 PM, came the following characters from the keyboard of Rhesa Rozendaal:Glenn Linderman wrote:[snip]On approximately 1/29/2004 4:39 PM, came the following characters from the keyboard of Chris Snyder:
Unless some better guruknows a trick!for /F "usebackq" %F in (`dir /b compp*.bat`) do perl -pi.bak -e "s#/new/#/#g" %F
Does that qualify me? ;^)
Well, since you asked.... no... there are two bugs in your command line, and it is overly complex. But using the CMD for loop isn't a bad idea, if done correctly.
My apologies... The use of the backticks I can explain though, because I use it mostly on directory trees, so I use dir /b /s. I should have simplified it.
When I ran that command, it didn't properly handle files containing spaces in the name, such as "compp foo.bat" ...
You're right, I never spotted that. That is a bug. But what is the second bug?
It is not clear why you chose such a complex version of the CMD for
the /s was the reason.
loop, the following one would have worked better:
for %F in (compp*.bat) do perl -pi.bak -e "s#/new/#/#g" "%F"
Note that even adding the "" around the final %F doesn't cure the problem with space-containing filenames when using your suggested syntax... I'm not sure why, even after reading the output of "for /?". Using the "delims" option helps, but I'm not at all sure what delims value would be appropriate.... I guess any character that cannot legally appear in a file name.
Thanks, I didn't know that one yet. Thank you for correcting me :^)
Rhesa _______________________________________________ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs