title: Use sed to delete all leading/following blank spaces in a text file
body: <p>File1:</p>
  
  <pre><code>  hello  
    world  
  </code></pre>
  
  <p>How would one delete the leading/trailing blank spaces within this file using sed - <strong>using one command (no intermediate files)</strong>?</p>
  
  <p>I've currently got:</p>
  
  <pre><code>sed -e 's/^[ \t]*//' a &gt; b
  </code></pre>
  
  <p>For leading spaces.</p>
  
  <pre><code>sed 's/ *$//' b &gt; c
  </code></pre>
  
  <p>And this for trailing spaces.</p>