From 71cf1ec44cb8fc1b56388d241f0721bd91f4587c Mon Sep 17 00:00:00 2001 From: olli <> Date: Mon, 21 Oct 2024 10:39:34 +0200 Subject: [PATCH] change expionential numbers in normal notation in given file --- gaboshlib/g_num_exponential2normal_file.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 gaboshlib/g_num_exponential2normal_file.sh diff --git a/gaboshlib/g_num_exponential2normal_file.sh b/gaboshlib/g_num_exponential2normal_file.sh new file mode 100644 index 0000000..6634784 --- /dev/null +++ b/gaboshlib/g_num_exponential2normal_file.sh @@ -0,0 +1,11 @@ +function g_num_exponential2normal_file { + # changes expionential numbers in normal notation in given file + local g_file=$1 + local g_substitution g_exnum + for g_exnum in $(egrep -o -i "[0-9]+\.[0-9]+e[\+\-][0-9]+" "$g_file" | sort -u) + do + g_num_exponential2normal $g_exnum && g_substitution="${g_substitution}s/${g_exnum}/${g_num_exponential2normal_result}/g;" + done + sed -i "${g_substitution}" "$g_file" && return 0 +} +