[NTLUG:Discuss] batch file rename

Bobby Wrenn bobby at wrennest.com
Mon Sep 8 12:09:21 CDT 2014


It's been a while since I have fiddled with regular expressions and I 
need a little help.

I have a single directory with many files with names in the format 
"CCC-01-10-2012.mp3". In need to rename each file into the format 
"20120110.mp3".
I tried;
ls *mp3 | sed s/CCC-\([0-9]+\)-\([0-9]+\)-\([0-9]+\).mp3/\3\1\2\.mp3/ | sh
but that returns "not found" for each entry.

What am I missing?

Thanks,
Bobby



More information about the Discuss mailing list