Extract IP address and a line above it from a text file
I have a text file in the following format.
From: <IP address>
The file contains about hundreds of such lines.
I am trying to extract username and timestamp data whose IP address is internal. I can extract IP address, but how do I get line above it? Right now, I am using grep command however that does not seem enough for this problem. Any ideas?