From 3b0f1f8e3aa9f3e926bb523a12496b7f2d8f78d6 Mon Sep 17 00:00:00 2001 From: olli Date: Tue, 28 Nov 2023 15:02:16 +0100 Subject: [PATCH] exponential numbers to normal --- dabo/functions/get_vars_from_csv.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dabo/functions/get_vars_from_csv.sh b/dabo/functions/get_vars_from_csv.sh index 594b947..357ce6a 100644 --- a/dabo/functions/get_vars_from_csv.sh +++ b/dabo/functions/get_vars_from_csv.sh @@ -143,7 +143,8 @@ function get_var_from_line { f_empty_var=1 fi else - #declare -g f_$1="$(echo ${f_last_line_array[$2]})" + # next line for exponential numbers (e.g. 7.86890874600464e05) to "normal" - coming sometimes from coingecko + [[ ${f_last_line_array[$2]} =~ ^(-)?(\.)?[0-9]+(\.)?([0-9]+)?(e-[0-9]+)?$ ]] && printf -v f_last_line_array[$2] -- "%.10f" "${f_last_line_array[$2]}" declare -g f_$1="${f_last_line_array[$2]}" fi f_all_vars="$f_all_vars