TimtheEagle wrote:
> 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.

Here is a possibility, very slow, that uses only 'grep'.  But it 
will also print the Framed-IP-Address field when this is not the 
third but the second or first line after the Username:

grep -B1 -A3 "Username = dthn" yourfile | grep -A4 "Acct-Status =" | 
grep -e Acct-Status -e Username -e Framed-IP-Address -e --

Benno


Reply via email to