【发布时间】:2021-09-20 22:43:59
【问题描述】:
我在数据目录中运行以下命令:
$ grep -r '0xdataH2O' ./
这个文件夹中有很多文件,我只想grep最近的文件。有没有办法做如下的事情:
$ grep -r '0xdataH2O' ./<$files_modified_within_last_two_days>
【问题讨论】:
我在数据目录中运行以下命令:
$ grep -r '0xdataH2O' ./
这个文件夹中有很多文件,我只想grep最近的文件。有没有办法做如下的事情:
$ grep -r '0xdataH2O' ./<$files_modified_within_last_two_days>
【问题讨论】:
find . -type f -mtime -2 -exec grep -H 0xdataH20 {} \;
【讨论】:
grep -H 是什么?我在手册页上找不到-H:man7.org/linux/man-pages/man1/grep.1p.html
-H, --with-filenamePrint the file name for each match. This is the default when there is more than one file to search. This is a GNU extension.man7.org/linux/man-pages/man1/grep.1.html