title: bash pull certain lines from a file
body: <p>I was wondering if there is a more efficient way to get this task done. I am working with files with the number of lines ranging from a couple hundred thousand to a couple million. Say I know that lines 100,000 - 125,000 are the lines that contain the data I am looking for. I would like to know if there is a quick way to pull just these desired lines from the file. Right now I am using a loop with grep like this:</p>
  
  <pre><code> for ((i=$start_fid; i&lt;=$end_fid; i++))
    do
      grep "^$i " fulldbdir_new &gt;&gt; new_dbdir${bscnt}
    done
  </code></pre>
  
  <p>Which works fine its just is taking longer than I would like. And the lines contain more than just numbers. Basically each line has about 10 fields with the first being a sequential integer that appears only once per file.  </p>
  
  <p>I am comfortable writing in C if necessary.</p>