#!/usr/bin/perl #This script will "grep" for msisdn's originating and destination and transaction numbers for the MXE LOGS or#"mon402.log" chomp($key = ); open(FILE, "mon402.log"); while () { foreach (sort {$a <=> $b} grep /$key/, grep s/<(.*?)>/TEXT/, $_) { print $_; } } #### #!/usr/bin/perl -w use strict; my %mylist; my $min; my $max; my $range; my $line; # get the range (in this throwtogether it must be entered # with no spaces in the form HH:MM:SS.TS-HH:MM:SS.TS) # Get the range $range = ; # Break up the range ($min, $max) = split /-/, $range; # Squeeze out leading and trailing spaces $min =~ s/^\s+//; $min =~ s/\s+$//; $max =~ s/^\s+//; $max =~ s/\s+$//; # Open the datafile and break into fields open(FILE, "mon402.log"); while () { if (s/<(.*?)>/TEXT/) { if ($_ =~ m/(\d+\-\w+\-\d+)\s(\d{2}\:\d{2}\:\d{2}\.\d{2})\s+(\w*)/) { # Push the restricted range of filenames onto a hash of arrays # keyed on the time field if (($2 ge $min) && ($2 le $max)) { push(@{$mylist{$2}}, $_); } } } } my @keys = sort (keys %mylist); foreach my $key (@keys) { foreach my $thing (@{%mylist}{$key}){ foreach my $it (@$thing) { print "$it\n"; last; } } } #### 27-Jun-2001 11:34:15.77 SendSMReq:T:1074 D:19209131848 O:19209131065 P:0x20 C:0x0 V:07-05 11:29 TEXT 27-Jun-2001 11:36:06.76 SendSMReq:T:1074 D:19207120303 O:19207131623 P:0x20 C:0x0 V:07-05 11:35 TEXT 27-Jun-2001 11:37:51.56 SendSMReq:T:1074 D:19209138833 O:19202928969 P:0x20 C:0x0 V:06-27 12:55 TEXT 27-Jun-2001 11:39:23.19 SendSMReq:T:1074 D:19207121543 O:Voice Mail MWI P:0x20 C:0xe1 V:07-05 11:39 TEXT 27-Jun-2001 11:41:08.90 SendSMReq:T:1074 D:16084468213 O:16083082487 P:0x20 C:0x0 V:06-27 12:40 TEXT