Hi all, I have a file that it looks as it follows

1 0.057         M       M       -       M
2 0.819         R       R       -       R
3 0.731         V       V       -       V
4 1.708         K       R       -       c
5 1.070         G       G       -       t
6 1.611         I       M       -       h
7 2.055         +       Q       -       p
8 1.748         +       R       -       +
9 0.864         N       N       -       N
10 2.146        a       W       -       h
11 1.782        Q       Q       -       .
12 2.707        +       H       -       p
13 0.893        .       -       -       .
14 1.252        L       L       -       h
15 0.659        W       G       -       W
16 2.150        +       K       -       p
17 1.137        W       W       -       W
18 0.976        G       G       -       G
19 2.022        .       -       -       .
20 0.147        .       -       -       .
21 0.124        .       -       -       .
22 0.023        .       -       -       .

I usually use the following awk comand awk '{if (!($2<0.5&&$3~/\./))
print $0}' filename to get rid of the rows where the third column
contains the "." caracter, and second column contain a number that is
lower than 0.5. In perl  the above command -translated using a2p tool-
translate into this:


#!/usr/sbin/perl
eval 'exec /usr/sbin/perl -S $0 ${1+"$@"}'
    if $running_under_some_shell;
   # this emulates #! processing on NIH machines.
   # (remove #! line above if indigestible)

eval '$'.$1.'$2;' while $ARGV[0] =~ /^([A-Za-z_0-9]+=)(.*)/ && shift;
   # process any FOO=bar switches

$[ = 1;   # set array base to 1
$, = ' ';  # set output field separator
$\ = "\n";  # set output record separator

while (<>) {
    chop; # strip record separator
    @Fld = split(' ', $_, 9999);
    if (!($Fld[2] < 0.8 && $Fld[3] =~ /\./)) {
 print $_;
    }
}

I will be very happy if anyone could help me to understand the script. I
am particularly lost with the eval function.
Cheers








--
***************************************************************************

PEDRO a. RECHE gallardo, pHD            TL: 617 632 3824
Scientist, Mol.Immnunol.Foundation,     FX: 617 632 3351
Dana-Farber Cancer Institute,           EM:
[EMAIL PROTECTED]
Harvard Medical School,                 URL: http://www.reche.org
44 Binney Street, D610C,
Boston, MA 02115
***************************************************************************


Reply via email to