linux中find查找指定时间段的文件并grep查找内容
发表于:2022-02-11 |
find . -type f -newermt '2016-01-01 00:00:00' ! -newermt '2016-02-01 12:00:00' -exec grep aaaa {} \; > tmp.txt

find -newerXY file/time:XY为占位符,a、B、m、c、t分别代表上次访问时间、创建时间、上次modify时间、上次索引节点改变时间和绝对时间;find根据Y的值来计算file的某个时间戳,然后根据X的值来做匹配。t不能做X。

上一篇:
linux的一个find命令配合rm删除某天前的文件
下一篇:
Mysql 一次性备份导出所有数据库