On 08/06/2012 17:16, lina wrote:
Hi,

Here is the to-be-processed file,

$ more try
   #  RESIDUE AA STRUCTURE BP1 BP2  ACC     N-H-->O    O-->H-N
N-H-->O    O-->H-N    TCO  KAPPA ALPHA  PHI   PSI    X-CA   Y-CA
Z-CA
     1  174   V              0   0    0      0, 0.0     2,-0.3     0,
0.0     0, 0.0   0.000 360.0 360.0 360.0 137.8   47.8   27.7   76.9
     2  175   H        -     0   0    0      2,-0.0     2,-0.3     0,
0.0     0, 0.0  -1.000 360.0-153.6-152.0 146.1   50.8   25.5   78.2

I wish to print the value under the BP1, namely

0
0

but no matter count from left or right, the field number is uncertain,

Thanks ahead for your suggestions,

Here is the one I come up so far,

#!/usr/bin/env perl

use strict;
use warnings;
use autodie qw(open close);
use 5.012;

my $filename = "try";

open my $fh, '<', $filename;

while(my $line =<$fh>){
        if($line =~ /^\s+ (1|2)/&&  $line =~ /\d$/) {
                
                my @fields = split ' ', $line;
                #say $fields[-12], "\t", $fields[-11];
        ;
        }
        
}

Hello Lina

Your email client has messed up the layout of your data file, and I
can't help without seeing exatly what it looks like.

I suggest you create a public Gist at https://gist.github.com/ and post
a link to it here.

Rob

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to