Your skill will accomplish
what the force of many cannot
Re: Re: pat match mult/lines mult/patby brassmon_k (Sexton)
|on Jul 27, 2001 at 19:09 UTC||Need Help??|
Yes I realized the mistakes I put in my initial entry like not defining the scalars above the array and neglecting array0 and array4 was non-existant.
I've already achieved the results that your idea puts out. I guess my problem is a bit odd to explain.
Those results are:
Here's what I did with your idea.
Now you see what this bit of code did seemingly match only the $var it's like (and) operator pattern matches are ignored and only one is accepted.
However I did indeed want those lines printed off but I also wanted the record block titles to print. If I do "print if /$vara/" it will do what I want print the record block titles but it will print all of them in the entire document. I only want it to print the section title when it finds the phone number. What I desire is output like the following: So to say it as clearly as I can is if I find the phone number in a record block such as "MSTerminating" or "MSORIGINATING" print the lines I specify like,
Is there anyway to tell PERL that "MSTerminating" is line1 for a record block and this "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'4F07" would be line13? Can you tell perl line numbers because I've been looking and that would be ideal for my situation then it would be easy as pie. I could arrange something such as - if you find $var in "MSTerminating" print $line1, $line2, etc. Then the exact results would be there. The only problem is each record block (Like 8 different ones) have a different number of lines and different data in each type of record block. The desired example output is below and I've illustrated the differences with putting (line#) after the text for 3 of the entries as you can see.
Please for the love of lines how do you do accomplish telling PERL this. I've scoured the net and a few books I have to try to figure out how to tell PERL which line to print but all I've found is pattern matching because it's easier. Well unfortuneately I think I need to know how to tell PERL go print line1 then line13 if you find this number under the "MSTerminating" block because that's the only way it can be done in my case I think.
David M. Hagens