[SLUG] Quick question

John Allsopp john at johnallsopp.co.uk
Mon Jul 21 18:41:21 BST 2008


John Allsopp wrote:
> Al Girling wrote:
>> Hi John,
>>
>> On Mon, Jul 14, 2008 at 08:33:06PM BST, John Allsopp wrote:
>>  
>>> Hope everyone's well.
>>>
>>> Quick question.
>>>
>>> In
>>> sed -i 's/KoolTrax/KoolTrax™/g' *.php*
>>>
>>> it's ignoring the &
>>>
>>> Presumably it's interpreting it in some way.
>>>     
>>
>> I suspect you're seeing KoolTraxKoolTrax#153; instead of the expected
>> KoolTrax™
>>
>>  
>>> How do I make it treat the & like the other characters?
>>>     
>>
>> You need to escape the '&' with a backslash like:
>>
>> sed -i 's/KoolTrax/KoolTrax\™/g' *.php*
>>   
>
> Thanks Al, sadly that's not working for me. I wonder if my Fedora 6(?) 
> setup is different somehow. The man page backs you up, and I'm just 
> wading through the info page, but what that command is doing is 
> replacing KoolTrax with KoolTraxKoolTrax#153; , ie. it's ignoring the 
> \ and doing the & thing anyway.
>
> Any thoughts?
>
> J
This doesn't work either:

sed -i s/KoolTrax/KoolTrax\d038/g *.php*

It should produce an ampersand (ASCII 38) but actually prints d038 
instead. Genius.

I'm thinking versions of regex but I don't know enough about those.

J




More information about the Scarborough mailing list