#!/usr/bin/perl chomp($msisdn = ); $/ = ""; # read paragraphs $cell = "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'4F07"; 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/) { if ($lines[5] =~ m/$cell/) { print "$lastHeading\n"; print "\n"; print "Cell ID for First Cell: MCC: 310 MNC: 64 LAC: x'44D CI: x'MAD023A\n"; print "$lines[8]\n"; # ninth line print "$lines[4]\n"; # fifth line } } elsif ($lastHeading eq "MSORIGINATING") { if ($lines[7] =~ m/$msisdn/) { print $lines[7]; # eigth line } } elsif ($lastHeading eq "mSOriginatingSMSinSMSIWMSC") { if ($lines[4] =~ m/$msisdn/) { print "$lines[4]\n"; # fifth line } } } } #### # Asks input for what msisdn (phone number) you are looking for and then it appends it's output to a file otherwise it is displayed on screen. # The fields, Called, Calling, and Redirecting are fields pulled out of the TTFILES # Script modified by David M. Hagens # Original script creator Jeff Toles # Copyright Airadigm Communications #!/usr/bin/sh echo "What msisdn?" read msisdn awk "BEGIN{ msisdn=\"$msisdn\"; }"' { #printf("%s\n", ARGV[2]) line14 =line13 line13 =line12 line12 =line11 line11 =line10 line10 =line9 line9 =line8 line8 =line7 line7 =line6 line6 =line5 line5 =line4 line4 =line3 line3 =line2 line2 =line1 line1 =$0 } /Called/ {if(match($9,msisdn)) a=1;} a>0 {if(a==1&&match(line12,"MSTerm")) {print "\n" line12"\n" line2"\n"line1;MSTerm=1} if(a==1&&match(line11,"TRANSIT")) {print "\n" line11"\n" line2"\n"line1; Transit=1} if((a==8||a==9||a==10)&&MSTerm) print $0 if((a==6||a==7||a==8)&&Transit) print $0 if (a++>10) { a=0;MSTerm=0;Transit=0}; } /Calling/ {if(match($9,msisdn)) b=1;} b>0 {if(b==1&&match(line10,"MSORIG")) {print "\n" line10"\n"; MSOrig=1} if(b==1&&match(line10,"TRANSIT")){print "\n" line10"\n"; Transit=1} if((b<=2||b==5||b==7||b==8)&&MSOrig) print $0 if((b<=2||b==7||b==8||b==9)&&Transit) print $0 if (b++>8) { b=0; MSOrig=0;Transit=0}; } /Redirecting/ {if(match($8,msisdn)) c=1;} c>0 {if(c==1&&match(line14,"CallForward")) print "\n" line14"\n" line5"\n" line4"\n" ; if(b<=5) print $0 if (c++>5) { c=0;}; }' output.abbazabba > msisdnoutput.abbazabba; echo "The file with your search results is called "msisdnoutput.abbazabba""