title: How can I print out all lines of a file containing a specific String in unix
body: <p>I know how to print out the line of the first occurrence of the String but I'm not sure how to  print out all occurrences. To print out the first occurrence of my String I have used </p>
  
  <pre><code>grep ",1," my_course.
  </code></pre>
  
  <p>I feel like printing out all occurrences would look something like: </p>
  
  <pre><code>    while(file has next line)
           grep ",1," my_course
  </code></pre>
  
  <p>I'm not sure how to do this while loop though. How do I test if file has next line.</p>
  
  <p>EDIT: Sorry guys I thought grep only matched the first occurrence. When I ran it, it only matched 1 line. I didn't know only 1 line matched</p>
  
  <p>Also, bonus question if someone wants to answer... if all the lines in my file (my_course) look like "number,name,credit hours,grade" how would I get all the grades in the file and store into an array?</p>