Remove Text from .txt file using python 2.7
<p>I have a text file that I need to append to be able to import into my database. There are some 4800 odd lines in the text file. The data is under. Can someone help me with a python script that will:</p>

<ol>
<li>Read the file</li>
<li>Remove everything except lines with NDC,xxxxx-xxxx-xx</li>
<li>Write a new file with the data NDC,XXXXX-XXXX-XX</li>
</ol>

<p>Notice that the NDC is some time in XXXX-XXXX-XX format and sometimes XXXXX-XXXX-XX format.</p>

<p>Here is some data:</p>

<pre><code>NDC,0065-0795-50

5.25667
48320,2
NDC,0517-2650-25

0.0411

NDC,51079-190-20

0.1582

NDC,0603-5450-21

0.7924
</code></pre>
