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
In reply to Tagging the last elements by crochunter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |