in reply to Re: matching patterns
in thread matching patterns
open ERASER,">output.txt"; close ERASER; open ERRORLOG, "<error.txt" or die "Can't read file error: $!\n"; open OUTPUT,">>output.txt" or die "Can't read file $!\n"; while( my $line = <ERRORLOG> ) { chomp $line; @line=split " ",$line; if ($line[0]=~ /^c/) { $line =~/(c([0-9]+)).*(0x[A-Fa-f0-9]+).*(0x[A-Fa-f0-9] ++)/; my $conn = $2; my @error = ($3, $4); my $value1= hex $error[0]; my $value2= hex $error[1]; my $unit = ''; if ($line =~/(unit=([0-9]+))/) { $unit= $2; }; my $port = ''; if ($line =~/(port=([0-9]+))/) { $port= $2; }; print OUTPUT "Conn: $conn, Value1: $value1,Value2: $v +alue2, Unit: $unit,Port1: $po rt,Stat: $line[6]\n"; } } close ERRORLOG; close OUTPUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: matching patterns
by SamCG (Hermit) on Apr 11, 2006 at 22:51 UTC |