bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

find patterns that are across multiple lines


From: TimtheEagle
Subject: find patterns that are across multiple lines
Date: Tue, 6 Mar 2007 12:46:00 -0800 (PST)

Hi folks,
I am trying to find a pattern that spans muliple lines.  It is to analyse
radius start and stop records for specific users.
I thought grep or awk was the answer but I am struggling with the multiple
line concurrent search.  
An example of the data is as follows:-

Acct-Status = Start
Username = address@hidden
next line content irrelevant
next line content irrelevant
Framed-IP-Address=10.240.4.5
next line content irrelevant

So I want to find and print the lines that have "Acct-Status =" on the line
directly above "Username = dthn" and also display the line beginning with
"Framed-IP-Address=10.240.4." where this line is the 3rd line after this
specific Username line.  So the output would be:-

Acct-Status = Start
Username = address@hidden
Framed-IP-Address=10.240.4.5

I am not sure if grep is the right tool and some may say that you should use
a database but I think that this sort of search would be very useful for
other things so it is worth pursuing.

Thanks for any help.
Tim
-- 
View this message in context: 
http://www.nabble.com/find-patterns-that-are-across-multiple-lines-tf3358168.html#a9340688
Sent from the Gnu - Grep mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]