Nov 18, 2002 #1 kevmullet Technical User Feb 12, 2002 56 GB OK so i have a bunch of files named like this: "songname - artist.mp3" and i would like them named like this: "artist - songname.mp3" Thanks for any help -K
OK so i have a bunch of files named like this: "songname - artist.mp3" and i would like them named like this: "artist - songname.mp3" Thanks for any help -K
Nov 18, 2002 #2 bigoldbulldog Programmer Feb 26, 2002 286 US This should help. If you have more than one ' - ' then you'll have to figure where the substrings go. for file in *.mp3 do mv -- "$file" `echo $file | sed 's/^\([^ ]*\) - \(.*\).mp3/\2 - \1.c/'` done Cheers, ND bigoldbulldog@hotmail.com Upvote 0 Downvote
This should help. If you have more than one ' - ' then you'll have to figure where the substrings go. for file in *.mp3 do mv -- "$file" `echo $file | sed 's/^\([^ ]*\) - \(.*\).mp3/\2 - \1.c/'` done Cheers, ND bigoldbulldog@hotmail.com
Nov 19, 2002 #3 bigoldbulldog Programmer Feb 26, 2002 286 US That's ... sed 's/^\([^ ]*\) - \(.*\).mp3/\2 - \1.mp3/'` ... Cheers, ND bigoldbulldog@hotmail.com Upvote 0 Downvote