|Perl Monk, Perl Meditation|
A new question from the front lineby bronto (Priest)
|on Oct 18, 2002 at 07:47 UTC||Need Help??|
bronto has asked for the
wisdom of the Perl Monks concerning the following question:
Hello fellow monks
Do you remember the question Save all but line 32!? Yesterday I had another question to which I gave a reply but I am interested again in how you had resolved the same issue. Here we go:
A colleague of mine asked me: "I have a text file that contains data record as lines; here and there between the data you have rows that tell you the names of the columns. If I find a line that contains, say, the word energy I want to print the line that follows it. In similar cases I resolved with awk, but I can't get a solution for this one and I don't want to code it in FORTRAN".
My solution was:
He then asked me if I could add a counter, and I slightly modified the previous in:
What's your solution for this?