Home > Net >  How to grep a directory based on the timestamp of the file?
How to grep a directory based on the timestamp of the file?

Time:09-21

I am running the following command in a data directory:

$  grep -r '0xdataH2O' ./

There are a lot of files in this folder, and I'd only like to grep recent files. Is there a way to do something like the following:

$ grep -r '0xdataH2O' ./<$files_modified_within_last_two_days>

CodePudding user response:

find . -type f -mtime -2 -exec grep -H 0xdataH20 {} \;
  • Related