I'm running a find command multiple times on the same group of files. The results of my find commands are usually disjoint sets, AKA I'm running find -mmin +35; find -mmin -25, and doing different things to the results.
It seems sort of silly to search through the entire file system multiple times when one search would do. Is there a way to put multiple "search parameters" into a single find command and pipe the ouput to a different place depending on which parameter it satisfies?
Best How To :
find . -mmin +35 -or -mmin -25
find supports several logical operators (-and, -or, -not). See the OPERATORS section of the man pages for more details.
==================== EDIT: In response to the question about processing the two matches differently, I do not know of a way to do this directly with find. Personally what I would do is to process the output in a for loop like this (note this is pesudo-code):
for f in `find . [condition 1] -or [condition 2]` ;do
if [ f meets condition1 ]; then
elif [ f meets condition2 ]; then
I'm sure there are many bash gurus out there who could do this cleaner and more efficiently.