title: Count word occurrence for all the files in a folder using Powershell
body: <p>I have a lot of text files like this</p>
  
  <pre><code>D1|This is text
  H1|This is line 
  </code></pre>
  
  <p>I would like to count and sum all the occurrence of "D1" in all these files in a folder.</p>
  
  <p>I tried </p>
  
  <pre><code> Get-ChildItem -Filter "*.text" -Recurse | Select-String -pattern "D1" -AllMatches).matches.count
  </code></pre>
  
  <p>but it is not working.</p>