Element 0: Packet ID (hex) 0xF040 Origin DOS 7452 Element 1: Date (mm/dd/yyyy) 09/07/2001 Qualifier ACS Element 2: Time 15:45:45.90 Terminal ID 109 Element 3: Device ID (hex) 0x2D0 Application ID SALESAPP Element 4: Catalog Code DOS Function ID(hex) 0x800E Element 5: Status 253 Severity 0 Element 6: Item code 772788600047 was not found in the PLU file Element 7: ------------------------------------------------- #### #!/usr/bin/perl -w use strict; my $searchdate=`date +%m\/%d\/%C%y`; my @Command=`ulread`; my $line; my @stripped=(); my %messages=("Cacheman"=>"0","sopup.sh"=>"0","switch_sh.sh"=>"0", "128"=>"0","NetBIOS"=>"0","Manual"=>"0","Beginning"=>"0"); foreach $line(@Command){ if($line=~/^-+$/){}else{ push @stripped,$line; } } for(1..4){ pop @stripped; } my (%hash,$count); for(@stripped){ $count++; m/Packet ID \(hex\) \s+ (\S+) \s+ Origin \s+ (\S+)\n Date \(mm\/dd\/yyyy\) \s+ (\S+) \s+ Qualifier \s+ (\w+)\n Time \s+ (\S+) \s+ Terminal ID \s+(\d+)\n Device ID \(hex\) \s+ (\w+) \s+ Application ID \s+(\w+)\n Catalog Code \s+ (\w+) \s+ Function ID \(hex\) \s+ (\w+)\n Status \s+ (\d+) \s+ Severity \s+ (\d+)\n(.*)/xi $hash{$count}{'packet_id'}=$1; $hash{$count}{'origin'}=$2; $hash{$count}{'date'}=$3; $hash{$count}{'qualifier'}=$4; $hash{$count}{'time'}=$5; $hash{$count}{'terminal_id'}=$6; $hash{$count}{'device_id'}=$7; $hash{$count}{'application_id'}=$8; $hash{$count}{'catalog_code'}=$9; $hash{$count}{'function_id'}=$10; $hash{$count}{'status'}=$11; $hash{$count}{'severity'}=$12; $hash{$count}{'message'}=$13; } open (RPT,">Logview.rpt")||die"Can't open: $!\n"; foreach my $key(keys %hash){ foreach my $msg(keys %messages){ if($hash{$key}{'message'}=~/$msg/ & $hash{$key}{'date'}=~/$searchdate/){ ## print out the entire record to the file } } } close RPT;