grab.awk translated to PERL

grab.awk translated to PERL

#!/usr/local/bin/perl

$[ = 1; # set array base to 1

$, = ' '; # set output field separator

$\ = "\n"; # set output record separator

while (<>) {

chop; # strip record separator

if (/^(cme|cbt|lif|smx)/) {

$start_point = $_ =~ '[0-9][0-9][0-9][0-9][0-9]+' &&

($RLENGTH = length($&), $RSTART = length($`)+1);

print $RSTART, $RLENGTH . ': ' . $_;

}

}

Previous slide Next slide Back to the first slide View Graphic Version