[SWLUG] Find And Replace.

David Scourfield david.scourfield at llynfi.co.uk
Thu Jan 7 15:30:53 UTC 2010


Adding a single backslash then space in your regex will be translated 
into just a space /within/ the regex (i.e., it will still assign the 
same result back to your variable).  You want the variable to contain a 
literal backslash when it gets passed to the mv command, so you need to 
escape the backslash in your regex, like this:

"s/-/\\ -\\ /"

I think that ought to work.

Dai


Andrew Jenkins wrote:
> Marcus.Davage at googlemail.com wrote:
>   
>> Try "s/-/\ -\ /"
>> (escape characters before the spaces.
>> M
>>     
> Ah, I was just trying that before your post. No, sorry
> exactly the same result as before (Amazing.mp3 is
> not a directory etc.)
>
> Andy.
>
>   



More information about the Swlug mailing list