I have thousands of .mp3 files that have recently been required and were appended with a dash -
and a series of various amounts of numbers. I would like to remove the last dash and the numbers to right of it.
Some examples are:
songName-artistName-12345.mp3
songName(1973)-artistName-12345.mp3
songName-artistName12d-12345.mp3
What I would like is:
songName-artistName.mp3
songName(1973)-artistName.mp3
songName-artistName12d.mp3
I have tried this:
ls | sed 's/\(.*\)\(-.*\)/mv \"&\" \"\1.mp3\"/' | bash
But, I've been getting a
syntax error near unexpected token '('
I've tried escaping any /
but that wasn't much help either. I have all these songs in one folder. And another folder with .wav
files.
Thanks for taking the time and reading!
ls
(and what to do instead)?