[nSLUG] Re: Removing spaces from file names - note, long lines

Mike Spencer mspencer at tallships.ca
Tue Nov 11 03:51:55 AST 2014

Stephen Gregory <nslug at kernelpanic.ca> wrote:

> As it is a perl regex you can do just about anything provided you
> don't mind opening a portal to the realm of the elder gods.

Gestorben ist nicht , was fur ewig ruht und mit unbekannten
Aoenen, mog sogar der Tod nach stirben.

> For those of you who like perl...

I love to hate perl.  It has something like pointers that don't and
something like lisp lists that aren't.  But it has whiz-bang regexps.

My most ambitous effort is a cgi-bin script on localhost that reads
the $QUERY_STRING from my browser, opens a socket on a particular www
server, makes a request, unpacks the chunked delivery and re-writes
several categories of URLs either to eliminate forwarding or to cause
them to point back to the script itself. And replaces RFC
2396-reserved characters with %xx escapes and undoes some %xx that are
screwed up.  Work in progress, a few little details to fix yet.  Good
workout for regex.  Use it every day.

Another fun exercise was figuring out a regex that would match
dotted-quad IP addresses in mail headers where something like may appear that isn't an address.  May require the Perl
"look-ahead" regex hack.

As for renaming files, I often end up with a bunch of image files
named something like image0065.jpg, image0066.jpg etc.  It's uaually
easy to just manually do something like:

   foreach foo (image*)
     mv $foo `echo $foo | sed -e 's/image00/party-aug-2014-/'`

(From which you can tell that I'm a csh user. I can use bash but I'm a
little weak on it.)

- Mike

Michael Spencer                  Nova Scotia, Canada       .~. 
mspencer at tallships.ca                                     /( )\
http://home.tallships.ca/mspencer/                        ^^-^^

More information about the nSLUG mailing list