Post by John EdwardsPost by gvimIn the `find' command how do I match an optional end character, eg.
match all files ending in 'html' or 'htm'?
find . -name '*.ht{m,ml}' -print
... doesn't work. Perl regexes have ? so what's the equivalent using `find'.
GNU find has a '-regex' option, but the man page says it only
supports Emacs regular expressions and not Perl compatible ones.
You can specify the regex type you'd like to use - there are a number of
choices (at least on my version of findutils)
man find:
-regextype type
Changes the regular expression syntax understood by -regex and
-iregex tests which occur later on the command line. Currently-
implemented types are emacs (this is the default), posix-awk,
posix-basic, posix-egrep and posix-extended.
so something like this:
find . -type f -regextype posix-extended -iregex '.*\.html?'
but in this case even the standard 'emacs' regex class works the way you
want
find . -type f -regex '.*\.html?'
should probably do what you're after
n.b. these examples all from
find (GNU findutils) 4.5.10
Stuart
--
Stuart Sears RHCA etc.
"It's today!" said Piglet.
"My favourite day," said Pooh.
--
Gllug mailing list - ***@gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug