Hi Martin,
> Bash regular expressions can come in handy when moving lots (but not
> all) files. For example
>
> mv DSCF0[4-6]*.jpg will move everything between DSCF04... to DSCF06...
> with one statement.
Strictly speaking those are not regular expressions. Their historic
name is "glob" patterns, after the program, glob(1), that used to expand
them. (That was back before the shell understood them.)
Classic globbing gives * to mean zero or more characters, ? to mean
exactly one character, and [] to indicate a set of characters with a
leading ! negating that set, e.g.
foo_?*_14[:.]20[:.]??[!.]
And a leading * doesn't match directory entries beginning with ".".
Because there's no way of specifying general alternation, or that a
chunk of the pattern can be repeated zero or more times, they don't have
the power of regular expressions. E.g. in the above example I've said
that the last character mustn't be a dot but I can't make it optional as
well whereas I can with the extended regular expression
^foo_.+_14[:.]20[:.]..[^.]?$
Cheers,
Ralph.
--
Next meeting: Somewhere quiet, Bournemouth, ???day 2010-12-?? 20:00
Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/
How to Report Bugs Effectively: http://goo.gl/4Xue