TimtheEagle <[EMAIL PROTECTED]> writes:
> 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.
Use awk or perl.
$ awk '/Acct-Status =/ { last_acct_status = NR; acct_status = $0 }
/Username = dthn/ && last_acct_status + 1 == NR {
last_username = NR; print acct_status; print }
/Framed-IP-Address=10\.230\.4\./ && last_user_name + 3 == NR'
Andreas.
--
Andreas Schwab, SuSE Labs, [EMAIL PROTECTED]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."