title: Split files based on file content and pattern matching
body: <p>I need your help with formate a txt file using bash/linux. The file looks like the following, it always has a line called Rate: Sth then it follows with the details in the very specific format. I'd like to split the file up with one rate for each file. In this example, I'd like to have 3 file, and each has the corresponding line says what the Rate value was. </p>
  
  <p>How will you approach this?</p>
  
  <pre><code>line No. Main Text
  1    Rate: GBP
  2    12/01/1999,90.5911501,Validated
       .....
       .....
  210  18/01/1999,90.954996,Validated
  211  Rate: RMB
  212  24/04/2008,132.2542,Validated
       .....
  1000 25/04/2008,132.2279,Validated
  1001 28/04/2008,131.69915,Validated
  1002 Rate: USD
  1003 21/11/11,-0.004419534,Validated
  </code></pre>