#!/usr/bin/perl # find-earliest-mark.pl %pckt = {}; # $pckt{$uid}[0] = $time # $pckt{$uid}[1] = $_ while () { # - 96.902063 1 0 19 1500 42.5 46.5 767961 302982 1 ---A 40 ----E-N 0 ($junk, $time, $qSrc, $qDst, $junk, $size, $src, $dst, $seqno, $uid, $ackno, $junk, $hdrsz, $flags, $junk) = split (); if (! exists $pckt{$uid} || (exists $pckt{$uid} && $time < $pckt{$uid}[0])) { $pckt{$uid}[0] = $time; $pckt{$uid}[1] = $_; } } foreach $p (keys %pckt) { print "$pckt{$p}[1]"; }