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

[OT] sed expression wildcard bafflement



a friend just asked me about a shell script she's trying to write.
she's got a file that looks like this:

  blah blah thi. blah thi. blah blah
  blah thi. blah thi. blah blah blah

&c. -- lots of "thi."s in there.

she's trying something equivalent to:

  word1=thi.;
  word2=this;
  sed 's/$word1/$word2/g' file > file.new;

and it doesn't replace.

i can replicate this from the command line.  the only way i can make
it work is to type out

  sed 's/thi./this/g' file > file.new;

escaping the period in $word1 does nothing.

are we just misunderstarding the sed command somehow?  otherwise,
afa[we]k, this is totally weird ...

thanks,

</nori>

-- 
    .~.      nori @ sccs.swarthmore.edu
    /V\  http://www.sccs.swarthmore.edu/~nori/jnl/
   // \\          @ maenad.net
  /(   )\       www.maenad.net
   ^`~'^
            get my (*new*) key here:
   http://www.maenad.net/geek/gpg/7ede5499.asc
      (please *remove* old key 11e031f1!)

Attachment: pgpRmmT50Dqra.pgp
Description: PGP signature


Reply to: