How do I remove 2nd and rest digits after a period from column one of lines?
<p>How do I remove 2nd and rest digit after the period from column one?<br>
For example,</p>

<pre><code>HP_000083.21423      N  -1  NO  99.8951%    0.000524499999999983
NP_075561.1_1908    N   -1  NO  99.9697%    0.000151499999999971
</code></pre>

<p>I would like to remove "_1908" from "NP_075561.1_1908" </p>

<p>and "1423 from "HP_000083.21423"</p>

<p>without removing other items from the subsequent columns.</p>

<p>Expected row would be:</p>

<pre><code>HP_000083.2         N          -1       NO        99.8951%  0.000524499999999983
NP_075561.1             N           -1      NO        99.9697%  0.000151499999999971
</code></pre>

<p>Here's my code: Some of you had provided part of this solution in the past.</p>

<pre><code>    for line in fname:
        line = re.sub('[\(\)\{\}\'\'\,&lt;&gt;]','', line)
        line = re.sub(r"(\.\d+)_\d+", r"\1", line) 
        fields = line.rstrip("\n").split()
       outfile.write('%s  %s  %s  %s  %s  %s\n' % (fields[0],fields[1],fields[2],fields[3],fields[4],(fields[5])))
</code></pre>

<p>Thanks in advance guys,
Cheers,</p>
