dimanche 1 février 2015

regex find replace strings starting or beginning with backslash


I have a compilation album in my music library that has song titles in the form of ARTIST/ TITLE, which is making it really difficult to cp or mv these files because of the backslash. So I'd like to rename the files to Title (Artist) to make them more manageable (and also so that they are named in a fashion consistent with the rest of my music library). Here's what I have so far.



#! /bin/bash

for i in ./*.flac; do
TITLE=`ls "$i" | sed #display string after backslash`
ARTIST=`ls "$i" | sed #display string before backslash`

mv ./"$i" ./"$TITLE ($ARTIST)"

done


Also remember that there is a space after the backslash in ARTIST/ TITLE which might mess things up too. Thanks for your help.



Aucun commentaire:

Enregistrer un commentaire