title: Split large text file(around 50GB) into multiple files
body: <p>I would like to split a large text file around size of 50GB into multiple files.
  Data in the files are like this-[x= any integer between 0-9]</p>
  
  <pre><code>xxx.xxx.xxx.xxx
  xxx.xxx.xxx.xxx
  xxx.xxx.xxx.xxx
  xxx.xxx.xxx.xxx
  ...............
  ...............
  </code></pre>
  
  <p>There might be few billions of lines in the file and i would like write for example 30/40 millions per file. 
  I guess the steps would be-</p>
  
  <ul>
  <li>I've to open the file  </li>
  <li>then using readline() have to read the file line by line and write at the same time to a new file  </li>
  <li>and as soon as it hits the maximum number of lines it will create another file and
  starts writing again.</li>
  </ul>
  
  <p>I'm wondering, how to put all these steps together in a memory efficient and faster way. I've seen some examples in stack but none of them totally helping what i exactly need. I would really appreciate if anyone could help me out.</p>