title: How to count all spaces in a file in Unix
body: <p>I want to count all the spaces from my file in Unix and I have tried the following command:</p>
  
  <pre><code>grep " " file1 | wc
  </code></pre>
  
  <p>It is giving me the following output:</p>
  
  <pre><code>3 6 34 
  </code></pre>
  
  <p>There are three spaces in my file so is it accurate command and further more how can I filter this to get exactly the spaces so only '3' should come as output and also how can I remove it</p>