Copy lines from a log file based on timestamp


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Copy lines from a log file based on timestamp
# 1  
Old 05-22-2008
Question Copy lines from a log file based on timestamp

how to copy lines from a log file based on timestamp.

INFO [11:08:00] (RbrProcessFlifoEventSessionEJB.javaSmilierocessFlight:274) - E_20080521_110754_967: rbrAciInfoObjects listing complete!
INFO [11:08:00] (RbrPnrProcessEventSessionEJB.javaSmilierocessFlight:197) - Event Seq: 1647575217; Carrier: UA; Flt#: 0106; Origin: LAX; Dest: O
RD; SchedDepDate: 2008-05-21; Psgr Boarded: true; Pnr Loc Value: ZSQJ3I
INFO [11:08:01] (RbrPnrProcessEventSessionEJB.javaSmilierocessFlight:197) - Event Seq: 1647575217; Carrier: UA; Flt#: 0106; Origin: LAX; Dest: O
RD; SchedDepDate: 2008-05-21; Psgr Boarded: true; Pnr Loc Value: RXK8XI
INFO [11:08:01] (RbrPnrProcessEventSessionEJB.javaSmilierocessFlight:197) - Event Seq: 1647575217; Carrier: UA; Flt#: 0106; Origin: LAX; Dest: O
RD; SchedDepDate: 2008-05-21; Psgr Boarded: true; Pnr Loc Value: QGPJBI


Like this i have soo much of data. i need to grep some part of lines based on timestamp [11:08:00 to 12:20:55]

pls help me out..
# 2  
Old 05-22-2008
OK, do a 'grep "time stamp here" file-name > filteredLogs.tmp; cp filteredLogs.tmp whateverNameYouLike.log and voila Smilie
The grep for particular pattern will output the lines matching the criteria, and then you redirect the result to a temp file, then you copy this file with a preferred name, HTH.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Filter records from a log file based on timestamp

Dear Experts, I have a log file that contains a timestamp, I would like to filter record from that file based on timestamp. For example refer below file - cat sample.txt Jan 19 20:51:48 mukul-Vostro-14-3468 systemd: pam_unix(systemd-user:session): session opened for user root by (uid=0)... (6 Replies)
Discussion started by: mukulverma2408
6 Replies

2. Shell Programming and Scripting

Check/Parse log file's lines using time difference/timestamp

I was looking at this script which outputs the two lines which differs less than one sec. #!/usr/bin/perl -w use strict; use warnings; use Time::Local; use constant SEC_MILIC => 1000; my $file='infile'; ## Open for reading argument file. open my $fh, "<", $file or die "Cannot... (1 Reply)
Discussion started by: cele_82
1 Replies

3. Shell Programming and Scripting

extracting lines based on condition and copy to another file

hi i have an input file that contains some thing like this aaa acc aa abc1 1232 aaa abc2.... poo awq aa abc1 aaa aaa abc2 bbb bcc bb abc1 3214 bbb abc3.... bab bbc bz abc1 3214 bbb abc3.... vvv ssa as abc1 o09 aaa abc4.... azx aaq aa abc1 900 aqq abc19.... aaa aa aaaa abc1 899 aa... (8 Replies)
Discussion started by: anurupa777
8 Replies

4. Shell Programming and Scripting

copy range of lines in a file based on keywords from another file

Hi Guys, I have the following problem. I have original file (org.txt) that looks like this module v_1(.....) //arbitrary number of text lines endmodule module v_2(....) //arbitrary number of text lines endmodule module v_3(...) //arbitrary number of text lines endmodule module... (6 Replies)
Discussion started by: kaaliakahn
6 Replies

5. Shell Programming and Scripting

copy files based on creation timestamp

Dear friends.. I have the below listing of files under a directory in unix -rw-r--r-- 1 abc abc 263349631 Jun 1 11:18 CDLD_20110603032055.xml -rw-r--r-- 1 abc abc 267918241 Jun 1 11:21 CDLD_20110603032104.xml -rw-r--r-- 1 abc abc 257672513 Jun 3 10:41... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

6. Shell Programming and Scripting

Delete log file entries based on the Date/Timestamp within log file

If a log file is in the following format 28-Jul-10 ::: Log message 28-Jul-10 ::: Log message 29-Jul-10 ::: Log message 30-Jul-10 ::: Log message 31-Jul-10 ::: Log message 31-Jul-10 ::: Log message 1-Aug-10 ::: Log message 1-Aug-10 ::: Log message 2-Aug-10 ::: Log message 2-Aug-10 :::... (3 Replies)
Discussion started by: vikram3.r
3 Replies

7. Shell Programming and Scripting

Grep: Copy all lines from log file into new file

Hello everyone. I have a log file that contains multiple domains: www.thisdomain.com agent.thisdomain.com that.thisdomain.com I need to copy all of the lines that contain "www.thisdomain.com" from the log and output them into a new file. I've tried everything with little luck. Please help... (3 Replies)
Discussion started by: aberli
3 Replies

8. Shell Programming and Scripting

concatenate log file lines up to timestamp

Hi, Using sed awk or perl I am trying to do something similar to https://www.unix.com/shell-programming-scripting/105887-sed-awk-concatenate-lines-until-blank-line-2.html but my requirement is slightly different. What I am trying to accomplish is to reformat a logfile such that all lines... (4 Replies)
Discussion started by: AlanC
4 Replies

9. Shell Programming and Scripting

copy lines from log files based on timestamp and sysdate

I'm looking for a command or simple script that will read lots of audit log file (*.aud) in log fold every 10 minutes, and will output to one file based on sysdate - 10 minutes. assume the script is run at 11:12:20, and it should grep the line from Wed Jun 17 11:02:43 2009 to end of file. after... (4 Replies)
Discussion started by: percvs88
4 Replies

10. Shell Programming and Scripting

copy lines from log files based on timestamp and sysdate

I am sorry to repost this question. it was not clear, and I had the meeting and didn't response the question on time. I do really need help and appreciate your help very much. I'm looking for a simple shell script that will read lots of audit log file (*.aud) in a log fold every 10 minutes,... (1 Reply)
Discussion started by: percvs88
1 Replies
Login or Register to Ask a Question