#!/usr/bin/perl chomp($msisdn = ); $/ = ""; # read paragraphs while ($para = <>) { $lastHeading; @lines = split(/\n/, $para); if (@lines == 1) # A Heading { $lastHeading = $lines[0]; next; } if ($lastHeading eq "MSTerminating") { if ($lines[8] =~ m/$msisdn/) { print "MSTerminating\n"; print "\n"; print "$lines[9]\n"; print "$lines[4]\n"; } } elsif ($lastHeading eq "MSORIGINATING") { if ($lines[7] =~ m/$msisdn/) { print "MSORIGINATING\n"; print "\n"; print "$lines[7]\n"; # sixth line } } elsif ($lastHeading eq "TRANSIT") { if ($lines[7] =~ m/$msisdn/) { print "$lines[7]\n"; } } elsif ($lastHeading eq "mSOriginatingSMSinSMSIWMSC") { if ($lines[4] =~ m/$msisdn/) { print "$lines[4]\n"; } } } #### MSTerminating Call Identification Number: 10275050 Related Call Number: 10275036 Record Sequence Number: 2205392 Exchange Identity: MAPP01E 0117802 MSC Identification: TON: 1 NPI: 1 MSISDN: "PHONE NUMBER" Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E Incoming Route: AORX02I Outgoing Route: BAPL01O Calling Party Number: TON: 4 NPI: 1 MSISDN: "PHONE NUMBER" Called Party Number: TON: 1 NPI: 1 MSISDN: "PHONE NUMBER I LOOK FOR IN AN MSTERMINATING RECORD BLOCK" IMSI: 310640010070933 IMEI: NULL Mobile Station Roaming Number: TON: 1 NPI: 1 MSISDN: 19207079858 Redirecting Number: NULL Redirection Counter: 0 Original Called Number: NULL Date for Start of Charge: 01/07/18 Time for Start of Charge: 00:14:38 Chargeable Duration: 00:00:00 Traffic Activity Code: *020 TeleService Code: x'11 Bearer Service Code: NULL Internal Cause and Loc: LOCATION: 11 CAUSE: 46 Time from Register Seizure to Start of Charging: 00:00:15 Time for Stop of Charging: 00:14:38 Interruption Time: 00:00:00 Type of Calling Subscriber: 0 Disconnecting Party: 0 Charged Party: 1 Fault Code: NULL eosInfo: x'0 Call Position: 2 Miscellaneous Information: NULL Restart During Call: NULL Restart Between Disc and Output: NULL Origin for Charging: x'1 Cell ID for Last Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'503E Location Number: TON: 1 NPI: 1 MSISDN: 14147089800 Output for Subscriber: NULL Last Partial Output: NULL Partial Output Rec Num: NULL Regional Service Used: NULL Region Dependent Charging Origin: NULL Transparency Indicator: NULL dTMFUsed: NULL Tariff Class: x'A Tariff Switch Indicator: 0 SS Code: NULL ICI Ordered: NULL #### $cell = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'2726'"; if (m/$cell/) { print Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'APPL20'; #### $1 = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'271B'"; %Firstcell = ( Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'2726', Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'271B', Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'3001'); @First = %Firstcell; ($a, $b, $c) = @First; if (lines[05] == m/$b/) { print "$1"; }