Hi there, I would like to know how to extract all the numbers after the ID (KC000001-3), including the number set after a tap using Perl regex.
The additional number (0.50) for the first ID, (0.60) second ID, and (0.70 0.80) third ID is always starting with a space as a new line and ending up with another tap.
\s space || \t tab
Input file.
KC000001\s0.30 0.40
\s0.50\t
KC000002\s0.30 0.40 0.50
\s0.60\t
KC152363\s0.30 0.40 0.50 0.60
\s0.70 0.80\t
I would like to get this output file.
output file
0.30 0.40 **0.50**
0.30 0.40 0.50 **0.60**
0.30 0.40 0.50 0.60 **0.70 0.80**
I have prepared this regex.
if ($linea =~ /^(.*[a-z0-9]\d+\.\d)\s(.*?)$/){
print $line
}
However, it is giving me the following error (it is not printing the number after the tab (0.50 for the first), (0.60 for the second), and (0.70 0.80 for the third))
0.30 0.40
0.30 0.40 0.50
0.30 0.40 0.50 0.60
I would like to know what is wrong with this regex. Is it possible to make it with a regex only?
Thanks for your help!
I formatted your code and you've removed the formatting - please edit it and add it back again. Without it, your post is not very readable.