title: Grep -> How to replace contents of a text file
body: <p>I have a text file that has a lot of lines and it is laid out like</p>
  
  <pre><code>zzzzz | id@host.tld |
  yyyyy | id@host.tld |
  </code></pre>
  
  <p>one of these per line for about 10 million lines.</p>
  
  <p>using a Grep expression, how can I do a replace to just get</p>
  
  <pre><code>zzzzz
  yyyyy
  </code></pre>
  
  <p>etc for each line in the file</p>
  
  <p>Maybe using Perl to rewrite out the file would be fine too, I just dont know a lot of Perl.</p>
  
  <p>UPDATE 1: Sometimes the export gets run to produce:</p>
  
  <pre><code>id@host.tld | zzzzz
  id@host.tld | yyyyy
  </code></pre>
  
  <p>UPDATE 2: Sometimes they leave row numbers in as:</p>
  
  <pre><code>a variable digit row number | zzzzz | id@host.tld |
  a variable digit row number | yyyyy | id@host.tld |
  </code></pre>
  
  <p>UPDATE 3: This file can contain lines with formats like:</p>
  
  <pre><code>zzzzz | id@host.tld |
  yyyyy | id@host.tld |
  id@host.tld | zzzzz
  id@host.tld | yyyyy
  variable digit row number | zzzzz | id@host.tld |
  variable digit row number | yyyyy | id@host.tld |
  </code></pre>