Hi,
Below is my Input file:
date mtime no size id day order
20100607 154538.354300 200 1 101510 14098703993
20100607 154539.420000 200 1 101511 14098703993
20100607 154538.398200 487 1 100888 14098703994
20100607 154610.720000 487 1 91588 14098703994
20100607 154538.401200 200 1 101502 14098703995
20100607 154539.420000 200 1 101500 14098703995
I need a perl code to get the foll o/p. For each unique order field, calculate the oldest mtime; and for each unique order field replace the day field by the oldest mtime. For example, the 1st 2 rows have the same order field=14098703993, for which the oldest mtime is 154538.354300 and hence we put this value into the day field. The output as below:
Output
date mtime no size id day order
20100607 154538.354300 200 1 154538.354300 14098703993
20100607 154539.420000 200 1 154538.354300 14098703993
20100607 154538.398200 487 1 154538.398200 14098703994
20100607 154610.720000 487 1 154538.398200 14098703994
20100607 154538.401200 200 1 154538.401200 14098703995
20100607 154539.420000 200 1 154538.401200 14098703995
Please help me guys with the code.. I have been trying for a long time now..!
Thanks,
Below is my Input file:
date mtime no size id day order
20100607 154538.354300 200 1 101510 14098703993
20100607 154539.420000 200 1 101511 14098703993
20100607 154538.398200 487 1 100888 14098703994
20100607 154610.720000 487 1 91588 14098703994
20100607 154538.401200 200 1 101502 14098703995
20100607 154539.420000 200 1 101500 14098703995
I need a perl code to get the foll o/p. For each unique order field, calculate the oldest mtime; and for each unique order field replace the day field by the oldest mtime. For example, the 1st 2 rows have the same order field=14098703993, for which the oldest mtime is 154538.354300 and hence we put this value into the day field. The output as below:
Output
date mtime no size id day order
20100607 154538.354300 200 1 154538.354300 14098703993
20100607 154539.420000 200 1 154538.354300 14098703993
20100607 154538.398200 487 1 154538.398200 14098703994
20100607 154610.720000 487 1 154538.398200 14098703994
20100607 154538.401200 200 1 154538.401200 14098703995
20100607 154539.420000 200 1 154538.401200 14098703995
Please help me guys with the code.. I have been trying for a long time now..!
Thanks,