[SWLUG] Find And Replace.
David Scourfield
david.scourfield at llynfi.co.uk
Thu Jan 7 16:33:56 UTC 2010
Ah-ha, i didn't think of dashes in folder names...
Geraint Edwards wrote:
> Ysgrifennodd David Scourfield <david.scourfield at llynfi.co.uk> said
> (on Thu, Jan 07, 2010 at 03:57:48PM +0000):
>
>> tested this, which works on subdirectory entries too:
>> tgt=$(echo $i | sed -e "s/-/ - /")
>>
>
> No, this will only change one dash, e.g.
> /Music/A-D/foo-bar.mp3
> will become
> /Music/A - D/foo-bar.mp3
>
> If, instead, you wanted
> /Music/A - D/foo - bar.mp3
> you will need the global flag on sed
> tgt=$(echo $i | sed -e "s/-/ - /g")
> but, to save an external sed, I'd use
> tgt=${tgt//-/ - }
>
>
More information about the Swlug
mailing list