I have a bunch of files which I'd like to rename. Currently they're like foo_0001_bar.jpg, foo_0002_bar.jpg etc. and I want to rename them to 0001.jpg, 0002.jpg etc.
The numbers aren't always the same number of characters, so there may be a foo_57_bar.jpg, but the stuff I want rid of is all the same.
I've googled somewhat, but most of the examples are about changing file extensions or other non-relevant aspects. I thought of ls'ing them into a file, then turning it into a script to mv them one by one, but there must be a quicker way.
Suggestions?