title: Using sed in terminal to replace text in file
body: <p>I have this text in this file:</p>
  
  <p><strong>test.php</strong></p>
  
  <pre><code>$databases = array (
    'default' =&gt; 
    array (
      'default' =&gt; 
      array (
        'database' =&gt; 'original',
        'username' =&gt; 'root',
        'password' =&gt; 'root',
        'host' =&gt; 'localhost'
      ),
    ),
  );
  </code></pre>
  
  <p>In terminal run this line to replace 'original' with 'new'</p>
  
  <pre><code>sed -i 's/original/new/g' test.php
  </code></pre>
  
  <p>UPDATE: The error message is:</p>
  
  <blockquote>
    <p>sed: 1: "test.php": undefined label 'est.php'</p>
  </blockquote>
  
  <p>What is the problem?</p>
  
  <p>UPDATE 2: </p>
  
  <p>If I just run: ( I removed '-i')</p>
  
  <pre><code>sed 's/original/new/g' test.php
  </code></pre>
  
  <p>I see the file text modified in the terminal. But then the file is not saved.</p>