[lug] Find Command
Tkil
tkil at scrye.com
Wed Sep 5 13:17:12 MDT 2001
>>>>> "SCDM" == deedsmis <SoloCDM> writes:
SCDM> How is it possible to force the find command to list all files
SCDM> with "read" in the filename, regardless whether they start with
SCDM> a period or not?
SCDM> I already tried the following:
SCDM> find /usr -iname ".*read*" -iname "*read*" -type f -print
note that all find predicates are "and"ed together by default. you
want to "or" them together... but that has lower precedence than the
default "and", so you also need to parenthesize them ... but
parentheses are interpreted by the shell. so:
find /usr \( -iname ".*read*" -o -iname "*read*" \) -type f -print
with gnu find, you should be able to use regexps to do the same thing,
but they match the whole path instead of just the base (grumble). so:
find blug -iregex '^.*/\.?[^/]*read[^/]*$' -type f -print
the first version is probably a little easier to read. :)
t.
More information about the LUG
mailing list