feedback Tim Klein was [CLUE-Tech] removing spaces from filenames?
Jed S. Baer
thag at frii.com
Tue Nov 19 10:42:30 MST 2002
On Tue, 19 Nov 2002 09:35:06 -0700
Dave Price <davep at kinaole.org> wrote:
> I needed to change the search line to:
> $newfile =~ s/$out_pat/$replace_pat/g;
>
> To get more than 1 space in the name ...
>
> (wish it could recurse)
The advantage of writing the script (any, not just Perl) as a filter (read
stdin, write stdout) is that it becomes easier to have it recurse or not
(I think). I haven't tested my script with the output of find -depth,
since I haven't needed to do a recursive rename. (Yeah, you could write
your script to do option processing.)
Also, FWIW, I wrote mine only as a half-filter coz the filenames I was
encountering were just too strange to reliably pipe stdout though a shell.
I started out doing that, cuz it was great to be able to see the results
of the substitutions before performing them. But I encountered cases where
" enclosing didn't work, or ' enclosing didn't work. Even ran across files
whose names started with a hyphen.
All this stuff is a great testament to the "there's more than one way to
do it" nature of *nix.
jed
--
We're frogs who are getting boiled in a pot full of single-character
morphemes, and we don't notice. - Larry Wall; Perl6, Apocalypse 5
More information about the clue-tech
mailing list