Fadhl M. Al-Akwaa wrote:
>
> Rob Dixon wrote:
>>
>> Fadhl M. Al-Akwaa wrote:
>>>
>>> no I show you the data in excell file to show you the desire column.
>>> the data is text file.
>> 
>> Then could you show us the text file please?
>
> but please note that the number of header lines is not equal. and the
> data within each line
> also is not equal.

(Please bottom-post your replies and send them to the entire list, so that
everyone can help you as well as benfit from the advice. Thank you.)

I'm not clear exactly what you need, but this program reads lines from the file
until it find the column header '# selected' somewhere in the line. After that
it just prints the fourth column of data split on white space. You will
something better than this if you need to access the later columns in the data
though.

HTH,

Rob


use strict;
use warnings;

open my $fh, '<', 'cluster1.bgo' or die $!;

while (<$fh>) {
  last if /# selected/;
}

while (<$fh>) {
  my @data = split;
  print $data[3], "\n";
}

**OUTPUT**

2
2
2
3
2
1
1
3
1


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to