I've done this in a multitude of ways in years past but not wanting to reinvent the wheel (so to speak) I am hoping that some readers here may have a script they would be willing to share.
My task is - given a partial name of a file, delete the last n occurences.
Example: ls -lt abc123* |wc -l yields say 10 files. I'd like to delete all above the count of a value such as 5 or 6.
Anyone know how to accomplish this without shell arithmetic or storing results in temp files?
I am quite curious to see how others may approach this.
Thanks for any scripts and/or snippets.
Bob
My task is - given a partial name of a file, delete the last n occurences.
Example: ls -lt abc123* |wc -l yields say 10 files. I'd like to delete all above the count of a value such as 5 or 6.
Anyone know how to accomplish this without shell arithmetic or storing results in temp files?
I am quite curious to see how others may approach this.
Thanks for any scripts and/or snippets.
Bob