in reply to Parsing multiple lines based on a given String
Some general advice: It is almost always easier to write "look ahead" rather than "look behind" code. By that I mean that parsing a file like this, I would find the HOSTNAME first and the IP address second. I associate those 2 things together and then decide to keep it or not. This is easier than finding the IP address and then trying to figure out in the previous lines what HOSTNAME it goes with.
Are you able to make a stab at some Perl code?
Just a few more example lines would be helpful.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing multiple lines based on a given String
by ArifS (Beadle) on Jun 22, 2016 at 16:10 UTC | |
by choroba (Cardinal) on Jun 22, 2016 at 16:21 UTC | |
by ArifS (Beadle) on Jun 22, 2016 at 16:43 UTC | |
by Marshall (Canon) on Jun 22, 2016 at 17:20 UTC | |
by choroba (Cardinal) on Jun 22, 2016 at 20:35 UTC | |
by Marshall (Canon) on Jun 22, 2016 at 21:03 UTC | |
by Marshall (Canon) on Jun 22, 2016 at 22:07 UTC | |
by ArifS (Beadle) on Jun 27, 2016 at 15:23 UTC |