LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1497|回复: 1

对指定时间段内的文件进行grep,如何写find命令?

[复制链接]
发表于 2005-10-31 23:08:05 | 显示全部楼层 |阅读模式
比如我要搜索/test目录下的所有2005-01-01到2005-02-01这段时间内的文件中,

哪些文件包含"abc"字段如何写find??


3Q
发表于 2005-11-1 02:12:21 | 显示全部楼层
Post by cheyo
比如我要搜索/test目录下的所有2005-01-01到2005-02-01这段时间内的文件中,

哪些文件包含"abc"字段如何写find??


3Q

you can try something like:

  1. grep "abc" $(find \! -mtime +days -a -mtime +days)
复制代码

the code means grep "abc" from the result of the find, which searches from files modified not older than +days (the first time contrain) but older than +days (the second time constrain). For instance, 1.1.2005 is 330 days ago and 2.1.2005 is 300 days ago, then this command can be like
  1. grep "abc" $(find \! -mtime +329 -a -mtime +299)
复制代码
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表