Script question for row comparison

From: Bischoff, Brent (Brent)** CTR ** (bischoff@alcatel-lucent.com)
Date: Mon Feb 19 2007 - 12:21:04 EST


Hi fellow sunmanagers,

I was tasked with writing a script to find multiple records in rows containing the same key. Then, within each record, only save the one that has the latest timestamp found in the Timestamp field. I would like to try this first in Perl and then fallback to KSH, AWK, SED, other if need be. I would like to ask the group if anyone as any suggestions on how to do develop such a comparison algorithm? Here is a sample input file:

Note the key '9194633401' is duplicated 3 times with 3 timestamps per record (345937231, 345937241, 345937251).

     Timestamp Key
      (Epoch)
--- ----------- ------------ -------- -------- ---- -----------------------
'I' '345937239' '9194633409' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937231' '9194633401' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937238' '9194633408' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937237' '9194633407' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'U' '345937241' '9194633401' '010023' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937236' '9194633406' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937235' '9194633405' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937234' '9194633404' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937233' '9194633403' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'D' '345937251' '9194633401' '010024' 'oflist' 'FR' 'Authorized_And_Active'
'I' '345937230' '9194633400' '010022' 'oflist' 'EN' 'Authorized_And_Active'

And here is what the script output should become:

     Timestamp Key
      (Epoch)
--- ----------- ------------ -------- -------- ---- -----------------------
'I' '345937239' '9194633409' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937238' '9194633408' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937237' '9194633407' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937236' '9194633406' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937235' '9194633405' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937234' '9194633404' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'I' '345937233' '9194633403' '010022' 'oflist' 'EN' 'Authorized_And_Active'
'D' '345937251' '9194633401' '010024' 'oflist' 'FR' 'Authorized_And_Active'
'I' '345937230' '9194633400' '010022' 'oflist' 'EN' 'Authorized_And_Active'

TIA and will provide a complete summary after any findings.

Thanks,
Brent
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:41:40 EDT