Re: get all lines between two lines



Sorry for talking to myself, but if your file is realy large, you
should use

sed -n '/^AFTERTIMESTAMP2/q;^TIMESTPAP1/,/^TIMESTAMP2/p' LOGFILE >>
NEWFILE

the new first part will quit the execution after the required part is
printed out.

Kind regards

Chris

Christoph Spohr wrote:
Hi,

something like

sed -n '/^TIMESTPAP1/,/^TIMESTAMP2/p' LOGFILE >> NEWFILE

should do the trick.

Kind regards

Chris

AFC wrote:
I have a huge file (more than 8 million lines), it is a log file and
each message body starts with timestamp information. Sample:

2008-09-19-06.05.40.704851-240 I516287092C387 LEVEL: Severe
PID : 413900 TID : 1 PROC : db2agent (DB)
0
.
.
.
.
.
.
.
2008-09-20-06.05.40.704851-240 I516287092C387 LEVEL: Severe
.
.
.
.

I would like to get details between two timestamps, like I need all
lines saved to a new file that are between 2008-09-19-06.05.40.704851
and 2008-09-20-06.05.40.704851.

could someone point me to right direction on how I should approach
this? Thanks!
.



Relevant Pages