[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sed :(



On Wed Mar 04, 2009 at 18:14:54 +0100, josep wrote:
>    why isn't it working? :(
> 
>    sed -i "s/#send host-name "andare.fugue.com";/send host-name $(cat
>    /etc/hostname)/g" /etc/dhcp3/dhclient.conf

  Because you've got nested quotes.  e.g. This fails:

  sed -i "s/"bob"/"chris"/g" /tmp/blah

  You need to escape the quotes inside your search/replace section.

  e.g to change "bob" to "chris" (including the quotes) you'd need:

  sed -i "s/\"bob\"/\"chris\"/g" /tmp/blah

Steve
-- 
Managed Anti-Spam Service
http://mail-scanning.com/


Reply to: