Grep from a range of dates as filenames

ぐ巨炮叔叔 提交于 2020-04-18 12:41:29

问题


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

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?


回答1:


To grep a string from specific range of file.

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


来源:https://stackoverflow.com/questions/16998003/grep-from-a-range-of-dates-as-filenames

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!