title: combine sed and sort commands in bash script
body: <p>I have this bash commands to filter words in a text file (file1 in the example)</p>
  
  <p>Until now i have to use two separate commands to get the result i want</p>
  
  <pre><code>sed -n "SAMPLETEXT" file1 &gt; file2
  sort file2 | uniq -c &gt; file2.tmp &amp;&amp; mv file2.tmp file2.txt 
  </code></pre>
  
  <p>because i need to filter out lines with certain strings from file1 and then count all equal lines.</p>
  
  <p>is there a way to do that all in one command to show the output in the console so that i dont need to even create a "file2"?</p>