Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Calltrace MENU
# This script is a menu and all files (Not TTFILES) associated with it + are located in the same directory. # All script explanations are located within the associated script fil +es themseleves # This menu is quite understandable so no explanation is needed. # Script written by David M. Hagens # Use as you want #! /usr/bin/sh LOGO="Call Trace Menu" amenu="a. Display search results" ; bmenu="b. Use a date only search" ; cmenu="c. Use a time only search" ; dmenu="d. Use a date range and time range search" ; emenu="e. Get call records" ; fmenu="f. Clean up search files" ; badchoice () { MSG="Invalid Selection... Please Try Again" ; } apick () { cat msisdnoutput.abbazabba | more; echo "\nPress Enter to r +eturn to menu"; read DUMMY; } bpick () { echo "Enter a range in the form YYMMDD-YYMMDD:>"; ./datesea +rch TTFILE* >> calltracedate.abbazabba; } cpick () { echo "Enter a range in the form HHMMSS-HHMMSS:>"; ./timesea +rch TTFILE* >> calltracetime.abbazabba; } dpick () { echo "Follow the trailing instructions:\n"; sleep 1; echo " +Enter a search range in the form YYMMDD-YYMMDD"; echo "Then push the +(ENTER) key, Next"; echo "Enter a search range in the form HHMMSS-HHM +MSS"; echo "Push the (ENTER) key again and you're done!"; ./narrowtim +esearch TTFILE* >> calltracenarrowtime.abbazabba; } epick () { echo "This choice makes call records readable then finds th +e number you are looking for.\n"; echo "NOTE: This process takes hour +s to complete because of the volume of data which is being searched.\ +n"; echo "NOTE: During the midpoint of this program you will be asked + to supply a msisdn.\n"; echo "Press Enter to Continue"; read DUMMY; +./calltracesed; } fpick () { echo "This removes files you created during your call recor +ds search.\n"; echo "If you wish to keep these files resident on the +system please choose 'n'.\n"; echo "Please remember to delete the fil +es you created by using this menu when you no longer need them.\n"; e +cho "Press Enter to continue"; read DUMMY; echo "Please choose 'y' fo +r (yes) or 'n' for (no)""\n"; ./calltraceremove; } themenu () { clear date echo echo "\t\t\t" $LOGO echo echo "\t\tNOTE: Search results can only be displayed after option 'd' +has been completed." echo "\t\tNOTE: You must do an 'b' 'c' or 'd' search before executing +option 'd'\n" echo "\t\tPlease Select:" echo echo "\t\t\t" $amenu echo "\t\t\t" $bmenu echo "\t\t\t" $cmenu echo "\t\t\t" $dmenu echo "\t\t\t" $emenu echo "\t\t\t" $fmenu echo "\t\t\tx. Exit" echo echo $MSG echo echo Select by pressing the letter and then ENTER; } MSG= while true do themenu read answer MSG= case $answer in a|A) apick;; b|B) bpick;; c|C) cpick;; d|D) dpick;; e|E) epick;; f|F) fpick;; x|X) break;; *) badchoice;; esac done
THE DATE & TIME SEARCH SCRIPT
#!/usr/bin/perl -w my %mylist; my $datemin; my $datemax; my $timemin; my $timemax; my $range; my $rangex; # get the range (in this throwtogether it must be entered # with no spaces in the form YYMMDD-YYMMDD) # Get the range $range = <STDIN>; $rangex = <STDIN>; # Break up the range ($datemin, $datemax) = split /-/, $range; ($timemin, $timemax) = split /-/, $rangex; # Squeeze out leading and trailing spaces $datemin =~ s/^\s+//; $datemin =~ s/\s+$//; $timemin =~ s/^\s+//; $timemin =~ s/\s+$//; $datemax =~ s/^\s+//; $datemax =~ s/\s+$//; $timemax =~ s/^\s+//; $timemax =~ s/\s+$//; # Get the filenames and break into fields chomp(@ARGV = <STDIN>) unless @ARGV; for (@ARGV) { if ($_ =~ m/(\w+)\.(\d{4})(\d{6})(\d{6})$/) { # push the restricted range of filenames onto a hash of arrays # keyed on the date field if (($3>= $datemin) && ($3 <= $datemax) && ($4>= $timemin) && ($4 <= $ +timemax)) { push(@{$mylist{$3}}, $_); } } } my @keys = sort (keys %mylist); foreach my $key (@keys) { foreach my $thing (@{%mylist}{$key}){ foreach my $it (@$thing) { print "$it\n"; } } }
THE SED SCRIPT
# This script first makes a file then appends to a file. The reason i +t has to append to a file is a sed command is involved # Which will then make the appended to file executable. Then it is ex +ecuted with dump_eric and it's output is appended to another file # Because without this file being executed the next script "calltrace. +awk" can't read the output to draw out a msisdn # Calltrace.awk finds the msisdn (phone number) you are looking for. # Script Written by David M. Hagens #! /usr/bin/ksh echo "Please choose the name corelating to your search:\n"; echo "'cal +ltracedate.abbazabba' for a date search"; echo "'calltracetime.abbaza +bba' for time search"; echo " or"; echo "'calltracenarrowtime.abbazab +ba' for a more specific search\n"; echo "Which trace file do you want +:>\c " read ANSWER if [ "$ANSWER" = "calltracedate.abbazabba" ]; then sed -e 's/^/\dump_eric /' calltracedate.abbazabba >> calltrace2.abbaza +bba; chmod 777 calltrace2.abbazabba; ./calltrace2.abbazabba >> output +.abbazabba; calltrace.awk; break; elif [ "$ANSWER" = "calltracetime.abbazabba" ]; then sed -e 's/^/\dump_eric + /' calltracetime.abbazabba >> calltrace2.abbazabba; chmod 777 calltr +ace2.abbazabba; ./calltrace2.abbazabba >> output.abbazabba; calltrace +.awk; break; else sed -e 's/^/\dump_eric /' calltracenarrowtime.abbazabba >> calltrace2. +abbazabba; chmod 777 calltrace2.abbazabba; ./calltrace2.abbazabba >> +output.abbazabba; calltrace.awk; break fi
THE AWK SCRIPT
# Asks input for what msisdn (phone number) you are looking for and th +en it appends it's output to a file otherwise it is displayed on scre +en. # The fields Called, Calling, Redirecting, are fields pulled out of th +e TTFILES # Script written by David M. Hagens # 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"line +1; 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 you +r search results is called "msisdnoutput.abbazabba""
THE CALLTRACE REMOVE SCRIPT
# This script removes files created by the user doing a calltrace. # if answer is "n" stop the script if the answer is "y" remove all .ab +bazabba files # Files have .abbazabba extension so when they are removed vital syste +m files will not accidentally be removed # Script written by David M. Hagens # Copyright Airadigm Communication #! /usr/bin/sh echo "Are you sure you want to remove these files" read ANSWER if [ "$ANSWER" = "n" ]; then sleep 1; break; elif [ "$ANSWER" = "y" ]; then rm *.abbazabba; else echo "Bad Option"; echo "Please answer y(yes) or n(no)"; read ANSWER fi

In reply to Erriccsons Dump Eric Data Search and output script by brassmon_k

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found