C
chet
the following script will parse records out of a log file.
my second grep doesn't find any records when it should
anybody know why (they exist in the file).
-thanx in advance.
#!/usr/bin/perl
#make te function calls
parse_lab_share ();
sub parse_lab_share ()
{
my @ins;
my @outs;
my @fields;
my $record;
my $login_str;
my $logout_str;
my $i;
unless ( open VNTILOG, "./vnti.log" )
{
die "Cannot open the vector log file: $!";
}
@ins = grep /VECGI/
&& !/ERROR/
&& !/Error/
&& !/Fragment/,
<VNTILOG>;
foreach ( @ins )
{
@fields = split;
if ( $fields[14] eq "in" )
{
$login_str =
"$fields[2]-$fields[1]-$fields[5]$fields[3]";
$record =
"$fields[23],$login_str,$fields[10],$fields[17]";
@outs = grep /$fields[23]/, <VNTILOG>;
foreach ( @outs )
{
@fields = split;
print ( "$fields[23]\n" );
}
}
}
#close the vector log file
close VNTILOG;
}
my second grep doesn't find any records when it should
anybody know why (they exist in the file).
-thanx in advance.
#!/usr/bin/perl
#make te function calls
parse_lab_share ();
sub parse_lab_share ()
{
my @ins;
my @outs;
my @fields;
my $record;
my $login_str;
my $logout_str;
my $i;
unless ( open VNTILOG, "./vnti.log" )
{
die "Cannot open the vector log file: $!";
}
@ins = grep /VECGI/
&& !/ERROR/
&& !/Error/
&& !/Fragment/,
<VNTILOG>;
foreach ( @ins )
{
@fields = split;
if ( $fields[14] eq "in" )
{
$login_str =
"$fields[2]-$fields[1]-$fields[5]$fields[3]";
$record =
"$fields[23],$login_str,$fields[10],$fields[17]";
@outs = grep /$fields[23]/, <VNTILOG>;
foreach ( @outs )
{
@fields = split;
print ( "$fields[23]\n" );
}
}
}
#close the vector log file
close VNTILOG;
}