[SWLUG] Find And Replace.
Marcus.Davage at googlemail.com
Marcus.Davage at googlemail.com
Thu Jan 7 14:30:03 UTC 2010
Try this in a script...
#!/bin/bash
for i in $( ls *.mp3 );
do
src=$i
tgt=$(echo $i | sed -e "s/-/ - /")
mv $src $tgt
done
Marcus
On , Andrew Jenkins <adjenkins at gmail.com> wrote:
> Hi All,
> OK guys, I've done this before using either "sed" or "grep" (or a
> combination of)
> and regular expressions but I just can't get it right this time.
> I have a few thousand MP3 files which are all under a general "Music"
> directory
> but all within separate directories under that. At the moment they have
> just a
> '-' (dash) between the artist name and the track name. I would like them
> to have
> ' - ' (space, dash, space) instead.
> The only common factors of all file names are that mentioned above and
> the .mp3
> on the end.
> eg
> Asia-Aqua.mp3 -> Asia - Aqua.mp3
> Any reg-ex experts out there?
> Andy Jenkins
> --
> Microsoft have broken Volkswagen's world record: Volkswagen only made
> 22 million bugs!
> _______________________________________________
> SWLUG Discussion List - Discuss at swlug.org
> http://swlug.org/mailman/listinfo/discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/swlug/attachments/20100107/22795a3f/attachment.html>
More information about the Swlug
mailing list