LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 04-08-2010, 12:47 PM   #1
shyork2001
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:

N3.2009-11-26-03-05-02.console.log.tar.gz
N4.2009-11-29-00-25-03.console.log.tar.gz
N6.2009-12-01-10-05-02.console.log.tar.gz

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?


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

Rep: Reputation: 129Reputation: 129
You can use the mktime function in awk seehttp://www.delorie.com/gnu/docs/gawk/gawk_138.html
 
  


Reply


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 03:06 PM.

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