find and searching for specific expression in files

Walt Pawley walt at
Sat May 30 18:08:56 UTC 2009

At 6:44 PM +0200 5/30/09, Wojciech Puchar wrote:
>> the famous back-tics.
>> 	% grep "expression" `find /path/to/files/ -mtime -2 -print`
>> Of course, there are surely easier, faster and better means,
>> but from this one, I know it just works. :-) Furthermore, I
>unless filelist exceed max lenght of arguments and unfortunately it
>happens often

I use bash as my default shell and have become rather enamored
with the construct

<make-a-list> | while read x; do <pretty-much-whatever> "$x"; done

which should get around the list length limitations and
provides for doing "extras" between the "do" and the "done".

find /path/to/files/ -mtime -2 -print | \
while read x; do grep "expression" "$x"; done

Walter M. Pawley <walt at>
Wump Research & Company
676 River Bend Road, Roseburg, OR 97471

More information about the freebsd-questions mailing list