I
Indigo5
This may be a simple question, but how would I use a regular expression to
convert reals to integers whenever possible. For example, if I had the
following lines
25.010 36.5 20.00
22.3 19. 35.
I would want those converted to
25.010 36.5 20
22.3 19 35
I know I can use something like:
s/\.$//g; to get rid of decimal points at the end of the string, but how do
I get rid of trailing zeros after the decimal point?
Would it be something like
s/\.(\d+)0$//g; ?
convert reals to integers whenever possible. For example, if I had the
following lines
25.010 36.5 20.00
22.3 19. 35.
I would want those converted to
25.010 36.5 20
22.3 19 35
I know I can use something like:
s/\.$//g; to get rid of decimal points at the end of the string, but how do
I get rid of trailing zeros after the decimal point?
Would it be something like
s/\.(\d+)0$//g; ?