I would like to only work with the data that has a line with |68| in it
print that line and then print each subsequent lines in that match
/\|7\|\d+\|\d+/ until #END is reached and then repeat for the rest of the
input data.

Below is what I have attempted.

Thanks in advance.

Chris


#!/usr/bin/perl

use warnings;
use strict;

my ( $col1, $col2, $col3 );

while( my $line = <DATA> ) {
chomp($line);
if ( $line =~ /(.*\|68\|.*)/ ) {
my $OM = $1;
print $OM, "\n";
}
 if ( $line =~ /(\|\d)\|(\d+)\|(\d+)/ ) {
$col1 = $1;
$col2 = $2;
$col3 = $3;
print join("\t", $col1, $col2, $col3 ), "\n";
}
}


__DATA__
#LOGNUM|68|OPERATIONAL
|NETWORK.1:SUBNETWORK.100:EBSC.1:EBSCSHELF.3:DSFPVCARD.6
|5883.2.0.330.1.1|5883.2.0.330.1.1|0x3|19|1|1
|ACP3|8
|7|1|9
|7|2|436
|7|3|5
|7|4|0
|7|5|0
|7|6|0
|7|7|0
|7|8|0
#END


#LOGNUM|69|OPERATIONAL
|NETWORK.1:SUBNETWORK.100:EBSC.1:EBSCSHELF.3:DSFPVCARD.6
|5883.2.0.330.1.1|5883.2.0.330.1.1|0x3|26|1|1
|ACP3|19
|7|1|0
|7|2|0
|7|3|0
|7|4|0
|7|5|0
|7|6|0
|7|7|0
|7|8|0
|7|9|0
|7|10|20
|7|11|0
|7|12|0
|7|13|0
|7|14|0
|7|15|0
|7|16|0
|7|17|0
|7|18|0
|7|19|0
#END


#LOGNUM|70|OPERATIONAL
|NETWORK.1:SUBNETWORK.100:EBSC.1:EBSCSHELF.3:DSFPVCARD.6
|5883.2.0.330.1.1|5883.2.0.330.1.1|0x3|68|1|1
|ACP3|12
|7|1|0
|7|2|2610
|7|3|0
|7|4|0
|7|5|2575
|7|6|0
|7|7|0
|7|8|0
|7|9|0
|7|10|0
|7|11|0
|7|12|0
#END

Reply via email to