title: Sed error: 'unescaped newline inside substitute pattern' and 'bad flag in substitute command'
body: <h3>Question:</h3>
  
  <p>I am new in sed，so when I excute following code in shell:</p>
  
  <pre><code>sed -e "/^\s&lt;key&gt;CHANNEL_NAME&lt;\/key&gt;$/{N;s/\(^\s&lt;string&gt;\).+\(&lt;\/string&gt;$\)/\1test\2}" Info.plist &gt; test.plist
  </code></pre>
  
  <p>Sed give me an error: "sed: 1: "/^\sCHANNEL_NAME&lt;\ ...": unescaped newline inside substitute pattern"</p>
  
  <p>My Question: What does "unescaped newline inside substitute pattern" exactly mean?</p>
  
  <p>The Info.plist file is like this:</p>
  
  <pre><code>...
  &lt;key&gt;CHANNEL_NAME&lt;/key&gt;
  &lt;string&gt;App Store&lt;/string&gt;
  ...
  </code></pre>
  
  <p>I am appreciate everyone could answer the question, thanks!</p>
  
  <hr>
  
  <h3>Anwser:</h3>
  
  <p>Thanks @potong @dogbane @Beta ! : )</p>
  
  <p>Because it is a Cocoa plist, so here's my finally solution:</p>
  
  <pre><code>sed '/&lt;key&gt;CHANNEL_NAME&lt;\/key&gt;/{N;s/\(&lt;string&gt;\).*\(&lt;\/string&gt;\)/\1test\2/;}' Info.plist &gt; test.plist
  </code></pre>
  
  <h3>Tips:</h3>
  
  <ol>
  <li>I got two error during my process to solve the problem. Put them here:
  <ul>
  <li>sed: 1: "/^\sCHANNEL_NAME&lt;\ ...": unescaped newline inside substitute pattern</li>
  <li>sed: 1: "/CHANNEL_NAME&lt;/ke ...": bad flag in substitute command: '}'</li>
  </ul></li>
  <li>I make so many mistakes in the first code.
  <ul>
  <li>haven't escaped the '+'</li>
  <li>should end with 2/}"</li>
  <li>acturally should end with 2/;}" (I miss a ';', so I got the second error in Tips 1)</li>
  </ul></li>
  <li>user 'n' or 'N' both works for me.</li>
  <li>Probably because of on Mac, the '.+' (even if I escaped) not work, so have to change it as @potong said, '..*'</li>
  </ol>
  
  <p>Any good advice to approve the code is welcome, thanks all the following guys again!</p>