crochunter has asked for the wisdom of the Perl Monks concerning the following question:
Here is the input file#!/usr/bin/perl use List::Util qw(min max); open(FH, $ARGV[0]) || die("Cannot open:$!"); while(<FH>) { if($_ =~ /\A(\S+)\t(\S+)\t(\S+)\t(\S+)\,(\S+)\,(\S+)/xmg) { #print "$1\t$2\t$3\t$4,$5,$6\n"; if(($5 == $5) && ($6 == $6)) { push @list, $4; $min = min @list; $max = max @list; if($4 == $max) { #print "$1\t$2\t$3\t$4,$5,$6\n"; print "$max\n"; } } } }
Here is the type of output I am trying to achieve :-62556 63635 y 1,andrew,JJ113954 63868 63897 h 1,morgan,JJ113955 68766 69005 j 2,morgan,JJ113955 81099 81630 y 1,flintoff,JJ113952 126185 126699 s 1,austin,JJ113956 135356 135449 3 1,peter,JJ113952 135588 136297 8 2,peter,JJ113952 158146 158367 i 3,peter,JJ113952 441474 441538 b 9,catherine,JJ029490 442666 442843 9 8,catherine,JJ029490 445778 445905 0 7,catherine,JJ029490 446059 446273 l 6,catherine,JJ029490 450319 450379 f 5,catherine,JJ029490
Thanks in advance62556 63635 y single,andrew,JJ113954 63868 63897 h 1,morgan,JJ113955 68766 69005 j end,morgan,JJ113955 81099 81630 y single,flintoff,JJ113952 126185 126699 s single,austin,JJ113956 135356 135449 3 1,peter,JJ113952 135588 136297 8 2,peter,JJ113952 158146 158367 i end,peter,JJ113952 441474 441538 b end,catherine,JJ029490 442666 442843 9 8,catherine,JJ029490 445778 445905 0 7,catherine,JJ029490 446059 446273 l 6,catherine,JJ029490 450319 450379 f 5,catherine,JJ029490
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tagging the last elements
by jbt (Chaplain) on Jul 28, 2009 at 04:17 UTC | |
by Anonymous Monk on Jul 28, 2009 at 04:20 UTC | |
|
Re: Tagging the last elements
by graff (Chancellor) on Jul 28, 2009 at 06:45 UTC | |
|
Re: Tagging the last elements
by Marshall (Canon) on Jul 28, 2009 at 08:12 UTC | |
by crochunter (Novice) on Jul 28, 2009 at 12:38 UTC | |
by roboticus (Chancellor) on Jul 28, 2009 at 12:55 UTC | |
by graff (Chancellor) on Jul 28, 2009 at 13:08 UTC | |
by Marshall (Canon) on Jul 30, 2009 at 04:32 UTC | |
by graff (Chancellor) on Jul 30, 2009 at 04:47 UTC | |
by Marshall (Canon) on Jul 30, 2009 at 04:50 UTC | |
|
Re: Tagging the last elements
by Anonymous Monk on Jul 28, 2009 at 04:18 UTC |