Re: REGEXP removing - il- - -b-f and - il- - - - f



JupiterHost.Net wrote:
DBSMITH@xxxxxxxxxxxxxx wrote:

yes I agree I was a little ambiguous... I was in a hurry. sorry. Anyway

Then do it at a later time and do it right, I imagine most all of us are busy also :)


here is my updated code. and here is a sample output:
My goal is to get all F01 which I am but I am having issues capturing all

Then you're doing a rube goldberg if that is indeed what you're trying to do:


# untested and prolly even more efficient way but it
# illustrates enhancements to the original code

#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;

$ENV{PATH} = '/opt/SUNWsamfs/sbin:/usr/bin:/usr/sbin:/usr/local/log';
open V4, 'samcmd v4 2>&1 |' or die "unable to open pipe: $!";

my @last_col;
for(<V4>) {
    chomp;
    my @tmp = split /\w+/;
    push @last_col, $tmp[ $#tmp ];
}

close V4;
print Dumper \@last_col;

now @last_col has all of the F01... pieces of data.

You do realize that the characters 'F', '0' and '1' are included in the character class \w which split() is removing? :-)



John
--
use Perl;
program
fulfillment
.



Relevant Pages

  • Re: REGEXP removing - il- - -b-f and - il- - - - f
    ... > which is just the F01 column, but when I comment out line 14 and uncomment ... > In the end I want the F01 column and the % column. ... is not a valid substitution statement. ... seriously recommend that you pick up a copy of a good intro perl book ...
    (perl.beginners)
  • Re: REGEXP removing - il- - -b-f and - il- - - - f
    ... When I run the I get the data I want to see which is just the F01 column, but when I comment out line 14 and uncomment line 15 and uncomment line 21 I see no data in the array??? ... versions of Perl however some earlier versions would use whitespace as the ...
    (perl.beginners)