title: Filtering a file in mac terminal
body: <p>I'm a complete novice at this, sorry if the tags aren't correct I'm not completely sure on the differences between a mac terminal and unix/linux. </p>
  
  <p>I'm working on a textfile on my mac terminal.</p>
  
  <p>I'm trying to filter column 4 so that only rows with  <strong><em>John</em></strong> are shown. Then exporting the 3rd row to a csv.</p>
  
  <p>example:</p>
  
  <pre><code>1 | 11/11/11 | 8:01 | John was here&lt;br/&gt;
  2 | 12/11/11 | 8:02 | Derek was here&lt;br/&gt;
  3 | 13/11/11 | 8:03 | John was also here&lt;br/&gt;
  4 | 14/11/11 | 8:04 | Bob was here&lt;br/&gt;                          
  </code></pre>
  
  <p>So far I've only managed to export the value I'm looking to filter by...</p>
  
  <pre><code>cut -f 4 Data_File_Name | grep -o "John" | sort -r &gt; Export_CSV_File.csv
  </code></pre>
  
  <p>I'm missing the fundamentals of showing the data that only has John whilst only exporting a specific column.</p>
  
  <p>Any help would be greatly appreciated </p>