View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 04-08-2010, 12:47 PM   #1
LQ Newbie
Registered: Apr 2010
Posts: 4

Rep: Reputation: 0
How to processing the log file within certain dates based on the file name

Hi I am working on the script parsing specific message "TEST" from multiple file. The log file name looks like:


I am using the following command:

zgrep -a --text "TEST" * | awk -F"[ .,]" '{sub(".*:","",$6); sub(",.*","",$7); print $1,$6,$7,$10}

and getting
N3 2009-11-25 20:12:57 TEST
N4 2009-11-28 10:42:18 TEST
N6 2009-12-01 10:00:24 TEST

If I only want to search the log file after 2009-11-29, what shall I change the command?

Old 04-08-2010, 03:35 PM   #2
Registered: Sep 2008
Location: The Netherlands
Distribution: Slackware64 current
Posts: 589

Rep: Reputation: 132Reputation: 132
You can use the mktime function in awk see


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
setting file permissions for file /var/log/Xorg.0.log mfb Linux - Security 1 07-07-2009 01:41 PM
Java File Processing using Scanner; Can't get it to read file in running directory xemous Programming 2 09-26-2006 06:13 PM
c++ file processing -- how to remove a record from a file sharonyiisl Programming 4 09-26-2004 03:54 AM
File Dates Rv5 Programming 5 09-07-2004 05:59 PM
File dates. vexer Programming 5 04-28-2004 12:14 AM

All times are GMT -5. The time now is 05:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration