My command is:
tac some_directory/*.pre | grep -im1 "vdr" | cut -c129-140
Output is:
1.710577E-03
I want the output to be:
1.71
How can I achieve this in the shell command?
My command is:
tac some_directory/*.pre | grep -im1 "vdr" | cut -c129-140
Output is:
1.710577E-03
I want the output to be:
1.71
How can I achieve this in the shell command?
Using awk:
As per your expected output:
echo 1.710577E-03 | awk '{printf "%.2f\n",a=$1*1000; a}'
1.71
Actual roundoff:
echo 1.710577E-03 | awk '{printf "%.5f\n",$1}'
0.00171
%.5
print up to 5 decimals.
f
float converter.
tac some_directory/*.pre | grep -im1 "vdr" | cut -c129-132
– Arushix Jun 27 '18 at 12:05-3
output will be 0.00171 – Siva Jun 27 '18 at 12:50