vis1982 has asked for the wisdom of the Perl Monks concerning the following question:
Suppose u have a file
860414 31 290 28 299 00931.17 HIGH CL1122
860412 501 541 501 554 00977.18 LRR_4 CL0022
860415 501 541 511 564 00977.33 LOW CL0023
Desired output If a particular column contain desired "HIGH", "LRR", "LOW" in one file print 1. Otherwise print 0.
So you will have lot of files where either of one or two not all three are present then print 0 so on..
#!/usr/bin/perl -w open (FILE,"$ARGV[0]") or die; my @temp =<FILE>; close FILE; my $f=join("",@temp); my @lastreco=split("\n",$f); foreach (@lastreco) { my @t= split("\t",$_); if ($t[7] =~ /HIGH/ && /LOW/ && /LRR/) { print "$1\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: print to match multiple pattern
by ww (Archbishop) on Sep 10, 2012 at 12:57 UTC | |
|
Re: print to match multiple pattern
by aitap (Curate) on Sep 10, 2012 at 12:43 UTC | |
|
Re: print to match multiple pattern
by Kenosis (Priest) on Sep 10, 2012 at 14:53 UTC | |
|
Re: print to match multiple pattern
by frozenwithjoy (Priest) on Sep 10, 2012 at 21:23 UTC | |
|
Re: print to match multiple pattern
by prashantktyagi (Scribe) on Sep 10, 2012 at 11:35 UTC | |
by vis1982 (Acolyte) on Sep 10, 2012 at 11:40 UTC | |
by Corion (Patriarch) on Sep 10, 2012 at 11:43 UTC | |
by vis1982 (Acolyte) on Sep 10, 2012 at 11:57 UTC | |
by RichardK (Parson) on Sep 10, 2012 at 12:02 UTC |