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 = [EMAIL PROTECTED]
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 = [EMAIL PROTECTED]
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