日期范围内的Grep作为文件名 [英] Grep from a range of dates as filenames

查看:137
本文介绍了日期范围内的Grep作为文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有多个文件,其中包含原始CDR.这些文件以模式cdr.log-2013-06-08-0100命名.像这样有多个文件:

I have multiple files which have raw CDRs in them. The files are named in the pattern cdr.log-2013-06-08-0100. There are multiple files like so:

cdr.log-2013-06-07-0000
cdr.log-2013-06-07-0100
.
.
cdr.log-2013-06-08-2200
cdr.log-2013-06-08-2300

我需要从2013年6月6日到2013年6月9日之间的一系列文件中提取grep字符串,我该怎么做?

I need to grep out a string from a range of files say between the date 6th june 2013 to 9th june 2013, how can I accomplish this?

推荐答案

从文件specific rangegrep的字符串.

find . -regex ".*cdr\.log-2013-06-0[6-9]-.*" -exec grep 'your string' {} +

这篇关于日期范围内的Grep作为文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆