From 62eb075739378a42805dd5c6b53890f0882096cd Mon Sep 17 00:00:00 2001 From: olli Date: Wed, 1 Nov 2023 11:35:31 +0100 Subject: [PATCH] for parallel gencharts --- dabo/functions/genchart.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/dabo/functions/genchart.sh b/dabo/functions/genchart.sh index 4f463fe..ee2e098 100644 --- a/dabo/functions/genchart.sh +++ b/dabo/functions/genchart.sh @@ -10,8 +10,10 @@ function genchart { local colors=$4 [ -z "${colors}" ] && colors="White,Gold,Silver,Blue,DarkMagenta,DarkViolet,Indigo,MediumBlue,DarkOrchid,MidnightBlue,CornflowerBlue,CadetBlue,DarkCyan,DarkSlateBlue,DeepSkyBlue,DodgerBlue,Teal" - local f_tmp_data="${g_tmp}-data-$RANDOM" - local f_tmp_headline="${g_tmp}-headline-$RANDOM" + local f_tmp="${f_tmp}/$RANDOM" + local f_tmp_data="${f_tmp}-data" + local f_tmp_headline="${f_tmp}-headline" + mkdir -p ${f_tmp}/g_genchart local awkfields=$(echo "${fields}" | sed 's/,/ \",\" \$/g; s/^/\$/') #tail -n ${lastlines} "${file}" | cut -d, -f${fields} | egrep "^[-0-9]" >${f_tmp_data} @@ -42,7 +44,6 @@ function genchart { local color="green" tail -n1 ${f_tmp_data} | cut -d, -f1 | grep -q "^-" && color="red" - mkdir ${g_tmp}/g_genchart local RND=$RANDOM echo "" else echo "" - fi >>${g_tmp}/g_genchart/${linenum} + fi >>${f_tmp}/g_genchart/${linenum} ((linenum=linenum+1)) lastmark=${mark} done @@ -84,7 +85,7 @@ function genchart { for linenum in $(seq 2 ${lines}) do echo "" - cat ${g_tmp}/g_genchart/${linenum} + cat ${f_tmp}/g_genchart/${linenum} echo "" done echo "
" echo "
" @@ -58,7 +59,7 @@ function genchart { echo "

${linename} (${linelastvalue})

" else echo "

${linename} (${linelastvalue})

" - fi >>${g_tmp}/g_genchart/legend + fi >>${f_tmp}/g_genchart/legend local linenum=1 for line in $(cat ${f_tmp_data}) do @@ -73,7 +74,7 @@ function genchart { echo "
${mark}
" @@ -93,7 +94,7 @@ function genchart { if grep -q ',' ${f_tmp_headline} then echo "" - tac ${g_tmp}/g_genchart/legend + tac ${f_tmp}/g_genchart/legend echo "" fi @@ -104,6 +105,6 @@ function genchart { echo "" - rm -r ${g_tmp}/g_genchart + rm -r ${f_tmp}/g_genchart }