in reply to Re: pat match mult/lines mult/pat
in thread pat match mult/lines mult/pat
Here's what I did with your idea.Calling Party Number: TON: 4 NPI: 1 MSISDN: 6082572086 Calling Party Number: TON: 4 NPI: 1 MSISDN: 6082572086 Charge Number: TON: 3 NPI: 1 MSISDN: 6082572086 Calling Party Number: TON: 4 NPI: 1 MSISDN: 6082572086 Calling Party Number: TON: 4 NPI: 1 MSISDN: 6082572086 Called Party Number: TON: 2 NPI: 1 MSISDN: 16082572086 Called Party Number: TON: 2 NPI: 1 MSISDN: 16082572086
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.chomp(my $var = <STDIN>); $var = qr($var); $var1 = "MSTerminating" $var2 = "MSORIGINATING" $var3 = "TRANSIT" my $pattern = qr($var1|$var2|$var3); while (<FILE>) { print if /$var/ && /$pattern/; }
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.MSTerminating Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'4F07 Calling Party Number: TON: 4 NPI: 1 MSISDN: 6082572086 (line15) Called Party Number: TON: 1 NPI: 1 MSISDN: 16084466501 (line16) Date for Start of Charge: 01/07/18 (line18) Time for Start of Charge: 00:14:33 Chargeable Duration: 00:00:00 MSORIGINATING Calling Party Number: TON: 4 NPI: 1 MSISDN: 6082572086 (line10) Called Party Number: TON: 1 NPI: 1 MSISDN: 16084466501 (line11) Date for Start of Charge: 01/07/18 (line30)
|
|---|