title: extracting specified line numbers from file using shell script
body: <p>I have a file with a list of address it looks like this (ADDRESS_FILE)</p>
  
  <pre><code>0xf012134  
  0xf932193  
  .  
  .  
  0fx12923a
  </code></pre>
  
  <p>I have another file with a list of numbers it looks like this  (NUMBERS_FILE)</p>
  
  <pre><code>20  
  40  
  .  
  .  
  12
  </code></pre>
  
  <p>I want to cut the first 20 lines from ADDRESS_FILE and put that into a new file<br>
  then cut the next 40 lines from ADDRESS_FILE  so on ...  </p>
  
  <p>I know that a series of sed commands like the one given below does the job </p>
  
  <pre><code>sed -n 1,20p ADDRESSS_FILE &gt; temp_file_1
  sed -n 20,60p ADDRESSS_FILE &gt; temp_file_2
  .  
  .
  sed -n somenumber,endofilep.  ADDRESS_FILE &gt; temp_file_n
  </code></pre>
  
  <p>But I want to does this automatically using shell scripting which will change the numbers of lines to cut on each sed execution.  </p>
  
  <p>How to do this ???  </p>
  
  <p>Also on a general note, which are the text processing commands in linux which are very useful in such cases?  </p>