What's a Unix/Linux one-liner that will let me delete all but the most recent N revisions of each file?
I've got a bunch of files with revision numbers as part of a legacy asset-management system:
bar.r7.js
bar.r8.js
bar.r9.js
bar.r10.js
bar.r11.js
foo.r1.js
foo.r2.js
foo.r3.js
foo.r4.js
...
I want to keep the last three of each, so in the above list the command would delete bar.r7.js
, bar.r8.js
and foo.r1.js
.