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

Re: sed :(



On Thu, Mar 05, 2009 at 12:04:32AM +0100, Emanoil Kotsev wrote:
> Tzafrir Cohen wrote:
> 
> > On Wed, Mar 04, 2009 at 06:21:18PM +0100, Johannes Wiedersich wrote:
> >> 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
> >> 
> >> your quotes don't match. (There are probably other issues as well.)
> > 
> > They actually do. Perfectly.
> > 
> >   echo "hello "world" !"
> > 
> > is the same as:
> > 
> >   echo "hello world !"
> > 
> > Though the OP probably wanted:
> > 
> >   echo "hello \"world\" !"
> > 
> > (As someone else in the thread already noted)
> > 
> 
> Oh, this is nonsense
> 
> we would then use echo to do the job of sed, wouldn't we?

Nither. We let $SHELL expand the command-line first.

But if you want a more complex example with sed:

  sed -e "somano "with" a dog" /etc/passwd
  sed -e "somano \"with\" a dog" /etc/passwd

-- 
Tzafrir Cohen         | tzafrir@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir@cohens.org.il |                    |  best
ICQ# 16849754         |                    | friend


Reply to: