Re: [ILUG] find regex question

From: Padraig Brady (padraig at domain antefacto.com)
Date: Wed 19 Jun 2002 - 11:54:42 IST


Nice post!

Brian Foster wrote:
> | Date: Tue, 18 Jun 2002 17:14:07 +0100
> | From: Padraig Brady <padraig at domain antefacto.com>
> |[ ... ]
> | yuk. Why put regex in find?
> | How about piping output of find to grep -E '[^/]*/[-0-9A-Z]{36}\.'
>
> because it's a powerful selection criteria?
> e.g., whilst you can pipe to `grep' to implement `And' conditions
> (e.g., is a directory And whose name matches the RE); it is much
> harder to do `Or' (e.g., is a directories Or whose name matches).
> having said that, `-exec sh -c "echo -E '{}' | grep -q ..." \;'
> could be used to do `Or' albeit at the cost of opaqueness (plus
> the usual newline-in-filename bugbear, see below) ....

agreed.

> because it closes a security hole?
> files whose names contain a newline (e.g.) make writing a 100%
> reliable pipe-to-`grep' very difficult, perhaps impossible!
> whilst GNU `find' does have `-print0', I am unaware of any
> corresponding _input_ option for any `grep'. hence, AFAIK,
> this hole cannot be closed when using pipe-to-`grep' ....

agreed.
Note grep 2.4 got the -Z option to OUTPUT a \0 after each filename
(which doesn't help in this case, but useful nonetheless).
Note also I'm in the process of completing a patch to textutils to add
standard args (including --null) to each.

[snip]

Padraig.



This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:17:21 GMT