Find files with specific date

Dear all,

kindly i have some files with different dates i need to grep word from these files but i need to search in files with date 2012-12-02 not all files in this directory

do u have any command

find /path/to/dir -type f -name "filename" -mtime -1 2>/dev/null | xargs grep -iw "word"

filename could be .txt , *abctxt etc.
-mtime -1 means modification(or creation time) less than 1 day

1 Like

The below will find all files in current directory that were created/last modified on given date and then will search in those files for any word.

 
ls -l | grep "Dec 12" | awk '{print $NF}' | xargs grep -l "word"
1 Like

If file name has the pattern: 2012-12-02 then:-

find . -name "*2012-12-02*" -type f -exec grep -w "word" {} \;

thanks alot for your contributions