I am trying to trim the final decimal numbers from a floating point number, but so far no luck.
echo "3/2" | bc -l | sed s/0\{1,\}\$
1.50000000000000000000
I was hoping to get 1.5, but somehow the trailing zeros don't get truncated. If instead 0\{1,\}I explicitly write 0 or 000000, etc., It discards the zeros as entered, but obviously I need it to be dynamic.
What happened to 0\{1,\}?
source
share