| Icarus Sparry 2007-08-22, 1:22 am |
| On Tue, 21 Aug 2007 23:53:06 +0000, Chris Allen wrote:
> On Aug 21, 3:25 pm, James Michael Fultz <xy...@sent.as.invalid> wrote:
>
> Thanks for that solution. Unfortunately I don't have access to GNU find
> and our security policy prevents me from installing it. I'm working on
> Solaris 8, with the standard built in tools. Is there anyway to do this
> with the regular find command?
It is not clear from your description if you want to find
bigtree/in_here/nothere/findme
or not. If you don't, another way of stating the problem is find the
files named "findme" in directories "in-here". From that it follows that
looking for directories named "in-here" (using find), and then looking in
them directly for "findme" will work.
If you have no reason to suspect weird characters in the filenames (in
particular newline characters) then
find . -type d -name in-here -print | while IFS="" read -r d ; do
if [ -f "$d/findme" ] ; then echo "$d/findme" ; fi
done
If on the otherhand you do want to find "findme" anywhere under "in-
here", then an approach is to list all the findme files, and then use
grep to only select the ones below in-here
find . -type f -name findme -print | grep '/in-here/'
Icarus
|