Fetch the lines between a file when a same pattern comes at the starting of line
<p>Please find my problem below.</p>

<p>I need to fetch the records from a file and split it into various files when the first 2 characters of the line is 10 till the next 10 appears.Its like line starting with 10 is header records and data, again for another data header begins.</p>

<p>Input file:</p>

<pre><code>10000002221300000223............................etc some informations
Data...
data....
data..
data....
data....
10000002332200006556...........................etc some informations
data2
data2
data2
data2
data2
</code></pre>

<p>Output file1:</p>

<pre><code>10000002221300000223............................etc some informations
Data...
data....
data..
data....
data...
</code></pre>

<p>Output file2:</p>

<pre><code>10000002332200006556...........................etc some informations
data2
data2
data2
data2
data2
</code></pre>