Grep - specific period

Hi everyone,

I want to use grep to search a patern in a folder. But the folder contains millions of files which makes a big delay if I want to search all the files in the folder. I have been trying to use grep to search the last 10 days of all the files. but no success yet! could you advice? thanks in advance.

Messi

you mean you wanna grep the files that have been modified within the last 10 days ?
Please give more clue : name of the folder, name of the files, pattern you are looking for ...

This should give you a list of filenames that are containing the pattern you look for

find <PATH> -type f -mtime -10 -exec grep -l <pattern> {} +

Basiclly the same as ctsgnb

simple compress - greater than 7 days

cd /mcdima03/consumer/rms_mf/
 
find ./ -type f -mtime +7 -print | grep -v .Z | xargs -n1 -i compress {} /mcdima03/consumer/rms_mf/datamart/