vis1982 has asked for the wisdom of the Perl Monks concerning the following question:
suppose u have a file 1 0.4 2 1 0.2 -5 1 0.1 -18 1 0.11 7 0 0.13 10 0 0.22 11
I have written the codeFrom the second column and third column , u want to show at differen +t intervals keeping second column fixed and change the interval in +the third column. Like at less than 0.01 from the scond column and <9 and <8 how many nu +mbers are there in one output then again keeping 0.01 same as above and then <8 and >7 how many numb +ers ...respectively Then change the interval from less than 0.01 to >0.01 and less tahn 0 +.02 in the second column and again start from the third column with +<9 and >8 respectively
#!/usr/bin/perl -w open (FILE,"$ARGV[0]") or die; open (WRITE,">ca_0.01_1.txt"); @list =<FILE>; close (FILE); my $f =join ("",@list); my @t = split ("\n",$f); foreach (@t) { my @x = split("\t",$_); if(($x[1]<=0.01) && ($x[0]=="0")) { next if ( $x[2]>=-8); next if ($x[2]<-9); #next if ($x[0]!=0); #next if ($x[0]!=1); print WRITE @x,"\n"; } } close (WRITE); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Keeping one colmun fixed and second column changed at different intervals to print the output
by halfcountplus (Hermit) on Nov 30, 2010 at 13:18 UTC | |
|
Re: Keeping one colmun fixed and second column changed at different intervals to print the output
by cdarke (Prior) on Nov 30, 2010 at 13:45 UTC | |
|
Re: Keeping one colmun fixed and second column changed at different intervals to print the output
by chrestomanci (Priest) on Nov 30, 2010 at 13:54 UTC | |
by vis1982 (Acolyte) on Nov 30, 2010 at 12:34 UTC | |
by vis1982 (Acolyte) on Dec 01, 2010 at 10:02 UTC |