I have a log file , that keep the record of system activities , as below , now the log is appending so that it becomes very large .
"
05/01/08 Normal userA
05/01/08 Normal userB
05/02/08 Alnormal userC
"
"
10/01/08 Normal userA
10/02/08 Normal userA
"
Now I would like to keep the log current , so if the date is over 60 days , then remove this row , like above , the first three row should be removed as 05/01/08 and 05/02/08 is over 60 days ( today is 10/08/08 ) , can advise how to do it ? thx
program execution shows the original file, and only those records that were of the last three days of entries.
> order_file296
original
05/01/08 blah
05/01/08 more blah
05/02/08 yep
06/01/08 ummmm
06/02/08 hmmmm
06/02/08 arrgggg
06/03/08 cool
07/04/08 hot hot hot
07/04/08 hooray
keep stuff
06/02/08 hmmmm
06/02/08 arrgggg
06/03/08 cool
07/04/08 hot hot hot
07/04/08 hooray
>
So, this approach sort of does what you are looking to do. Depends on the data you have - if there is an entry for everyday, then this logic would be fine. Probably a couple other tweaks necessary, but I leave those to you to figure out.