I don't understand how interactive it's supposed to be?

Do you mean that it should ask you everytime "do you want to match
file?".

I don't which RegEx engine you want to use, nor the programming
language, but at least in GNU `find', one can use something like:

find "." -regex '.*\.png$' -print

... this will search recursively from the current directory (!) and
print the relative path to each matched file that has .png file
extension (although this doesn't guarantee that the MIME type will be
that of .png file). This provides some "interactive result" because it
does nothing besides printing the matches.

Note that GNU `find' uses Emacs regular expressions by default (unless
you use `-regextype' before), which as far as I know is similar to Basic
Regular Expressions but with more features.

Finally, notice that your `-regex' must deal with the full relative path,
that is, simply using "\.png$" would return nothing (because it fails to
consider "." path, and also the subdirectories).

You could elaborate a little more and say that you only want things
inside two directory/path levels, like so:

find "." -regex '\([^/]+/\)\([^/]+/\)[^/]+\.png$' -print

But this is probably not efficient, it would be best to use:

find "." -mindepth 2 -maxdepth 2 -name '*.png' -print

Note that in the last command example `-name' uses Pathname Expansion
(see `info bash' for explanation), not regular expressions.

2017-11-27T08:43:50-0600 Caleb Herbert wrote:
> If I were going that route, I'd be using regex-builder in Emacs, but
> sometimes even it isn't interactive enough.
>
>

-- 
- https://libreplanet.org/wiki/User:Adfeno
- Palestrante e consultor sobre /software/ livre (não confundir com
  gratis).
- "WhatsApp"? Ele não é livre. Por favor, veja formas de se comunicar
  instantaneamente comigo no endereço abaixo.
- Contato: https://libreplanet.org/wiki/User:Adfeno#vCard
- Arquivos comuns aceitos (apenas sem DRM): Corel Draw, Microsoft
  Office, MP3, MP4, WMA, WMV.
- Arquivos comuns aceitos e enviados: CSV, GNU Dia, GNU Emacs Org, GNU
  GIMP, Inkscape SVG, JPG, LibreOffice (padrão ODF), OGG, OPUS, PDF
  (apenas sem DRM), PNG, TXT, WEBM.

Reply via email to