title: Reading/greping a file in ruby more than once
body: <p>How can I reset the <em>"pointer"</em> of a file to its start without reopening it? (Something like <code>fseek</code> in C?)</p>
  
  <p>For example, I have a file that I want to grep for two patterns:</p>
  
  <pre><code>f=open('test') =&gt; #&lt;File:test&gt; 
  f.grep(/llo/)  =&gt; ["Hello world\n"] 
  f.grep(/wo/)   =&gt; [] 
  </code></pre>
  
  <p>Is it possible to reset <code>f</code> without reopening the file?</p>
  
  <p>Note: I am not looking for workarounds; I can think some on my own ;).</p>