Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Awk > How search from...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 2153 of 2317
Post > Topic >>

How search from "this point" and forward...

by di98mase <di98mase@[EMAIL PROTECTED] > Feb 7, 2008 at 06:04 AM

Hi all,

I have a big log file that looks like this:

/I/Start/info/logId(1)
/I/Start/info/logId(1)
/W/other stuff/
/I/Start/info/logId(2)
/I/Start/info/logId(2)
:
:
/W/more stuff/
/W/other stuff/
/I/End/info/logId(1)
/I/End/info/logId(1)
/W/more stuff/
/W/other stuff
:
/I/End/info/logId(2)
/I/End/info/logId(2)

the 4 rows that have Start and End in the beginning are all parts of
the same log item if they have the same logId(n). In my example above
there are 2 log pairs (logId(1) and logId(2)).

So I need to gather information from these 4 lines and put store this
as information in another file. So my idea is to create a awk program
that will:
serach for regex '/I/Start' and read the logId
browse the rest of the log file for the End logs with the same logId
when all log lines are found and the information stored and printed
continue on in the log file. Just make sure that the logId has not
been used before.

My problem is to understand how I shall do the "browsing" in the input
file. this is what I mean: if I find the first Start log on line 5, if
I use getline to parse the rest of the input file and if I find the
End log online 34, how do I continue from line 6 for the next
"search"? as far as I understand using getline will have the effect
that the program will look at line 35 for the next Start log thus
missing all logs between 6 and 33, or did I missunderstand?

/di98mase
 




 6 Posts in Topic:
How search from "this point" and forward...
di98mase <di98mase@[EM  2008-02-07 06:04:31 
Re: How search from "this point" and forward...
Ed Morton <morton@[EMA  2008-02-07 08:35:52 
Re: How search from "this point" and forward...
di98mase <di98mase@[EM  2008-02-07 07:44:25 
Re: How search from "this point" and forward...
Ed Morton <morton@[EMA  2008-02-07 10:29:00 
Re: How search from "this point" and forward...
di98mase <di98mase@[EM  2008-02-08 14:32:20 
Re: How search from "this point" and forward...
Janis Papanagnou <Jani  2008-02-09 01:11:48 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:22:43 CDT 2008.