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.
In reply to Re: Parsing multiple lines based on a given String
by Marshall
in thread Parsing multiple lines based on a given String
by ArifS
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |