Clearing a flatfile
Posted on 2003-10-21
I'm a novice with progamming, and I need urgently a simple Perl script code to put in cron to do a clear task, this way:
I have a flat file, where there is a field which is a sequence number. Each record has this field added by one, as the records were being created. Something like this:
All I need is to clear this file, deleting records, leaving only the "n" most recent, that is, the "n" records (lets say 50) with the greatest values in this field.
Thanks a lot for this great help.