Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Help with sed

  1. Oct 26, 2005 #1
    I need some help with a sed command.

    want to take a file new.f and replace the phrase "blattnig" with "blattnig/sirest" every where in it. Well sed doesn't seem to like the slash. Is there an escape character in sed so it reads the / correctly?
  2. jcsd
  3. Oct 26, 2005 #2
    backslash (\) will escape the / like this:


    also, & repeats the search pattern like this:


    Also, the reason you need to escape the slash is because you used the slash for a separator. Try this:


    In other words, the first character after the s is the separator.
  4. Oct 26, 2005 #3
    it didn't like this at all. It still atleast the first one.

    very good to know! you don't have to use the / as a separator. Thanks a ton for the quick reply.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook