|There's more than one way to do things|
pat match mult/lines mult/patby brassmon_k (Sexton)
|on Jul 26, 2001 at 23:15 UTC||Need Help??|
brassmon_k has asked for the
wisdom of the Perl Monks concerning the following question:
First off I never ever matched on multiple lines cuz I never had to. That is a prob for me. I have to go through pages of the text below: I'll describe my prob here and you can look through the text and my proposed solution is below the text. OK first off you see the crazy heading mSOriginatingSMSinSMSIWMSC that is the record block title Then the data for the record. The data I need to have matched are the lines I've enclosed with exclamation marks. Here's how
I need them matched.
What this script is concerned about is multiple Title block names. Lines called "Calling or Called Party" that have a MSISDN or phone number which a person running a search would specify by <STDIN>.
What I need done is relatively simple but I've tried working on this for like 3 days and get jack for results. What I need is for this search to:
Search through the text (When it finds the MSISDN number the user entered on <STDIN> the script needs to print the Record Block title, the Called Party & Calling Party lines, the Charged Party line, the Chargeable Duration line, and the Cell ID line. It gets worse because the same lines aren't in all the Record Blocks and I don't have a clue on how to structure this. So I'd have to say something like this to the script.
Okay if you find the MSISDN that I gave you look and find the record block title (Let's just say 3 types although there are more MSTerminating, MSORIGINATING, TRANSIT) if it is MSTerminating print these lines, if it is MSORIGINATING print these lines, If it is TRANSIT print these lines
Here is the text:
I was thinking if I do something like the below I can get what I want?
However the matching statements don't seem to want to accept the match for 2matches with the (and) operator. I'd assume they would but I don't know how to say if you match this and this then print this with the proper syntax. I'm lost.