title: How to get no. of lines count that matches a string from all the files in a folder
body: <p><strong>Problem Description:-</strong>  I have a folder which contains so many text files. I want to search for a particular string say "string_example" in all files in that folder.Then I should get the count of total no. of lines in all files which has the string "string_example". That means if there are 5 matching lines in 1st text file,10 matching lines in second text file, 3 matching lines in 3rd text file.Then the output should be 5+10+3=18</p>
  
  <p><strong>What I Have tried:-</strong>  I have surfed through the internet and found some commands like </p>
  
  <ul>
  <li><code>grep -r -n ".string_example" .</code> </li>
  </ul>
  
  <p>This bash command will print the file name along with line number of the lines which contains the string "string_example".Here is the sample output for better understanding</p>
  
  <p>1st file:1:string_example is there</p>
  
  <p>1st file:2:string_example is not there</p>
  
  <p>2nd file:1:string_example is there</p>
  
  <p>etc.......But the actaul output I want is 3 from the above output.</p>
  
  <p>I have also tried few more bash commands but of no use.</p>
  
  <p><strong>My Question</strong>:- Is there any bash command for this kind of purpose.If not how to write a script for the following requirement.</p>
  
  <p>Pls help me</p>