[Gllug] Match optional character in filename expansion with find
Robert McKay
robert at mckay.com
Thu Feb 16 15:03:10 UTC 2012
On Thu, Feb 16, 2012 at 2:57 PM, gvim <gvimrc at gmail.com> wrote:
> In 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'.
I'm not sure if there's a better answer but find does support using
multiple -name parameters that can be -and'd or -or'd together. So you
could simply do;
find . -name '*.htm' -o -name '*.html' -print
Rob
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list