title: How to make sed read its script from a file?
body: <p>Recently I came across following grep command:</p>
  
  <pre><code>/usr/xpg4/bin/grep -Ff grep.txt input.txt &gt; output.txt
  </code></pre>
  
  <p>which as per my understanding means that from input.txt, grep the matter contained in grep.txt and output it to output.txt.</p>
  
  <p>I want to do something similar for sed i.e. I want to keep the sed commands in a separate file (say sed.txt) and want to apply them on input file (say input.txt) and create a output file (say output.txt). </p>
  
  <p>I tried following:</p>
  
  <pre><code>/usr/xpg4/bin/sed -f sed.txt input.txt &gt; output.txt
  </code></pre>
  
  <p>It does not work and I get the following error:</p>
  
  <pre><code>sed: command garbled
  </code></pre>
  
  <p>The contents of files mentioned above are as below:</p>
  
  <p>sed.txt</p>
  
  <pre><code>sed s/234/acn/ input.txt
  sed s/78gt/hit/ input.txt
  </code></pre>
  
  <p>input.txt</p>
  
  <pre><code>234GH
  5234BTW
  89er
  678tfg
  234
  234YT
  tfg456
  wert
  78gt
  gh23444
  </code></pre>