sort multiple matches

This commit is contained in:
olli 2024-10-17 17:16:59 +02:00
parent 16bb308c4b
commit f36485f1eb

View File

@ -101,10 +101,12 @@ function currency_converter {
do
# search for most precise date
f_line=$(egrep "^$f_currency_date_minute" "$f_histfile"*m.csv 2>/dev/null | tail -n1)
[ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_hour" "$f_histfile"*m.csv 2>/dev/null | tail -n1)
[ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_day" "$f_histfile"*h.csv 2>/dev/null | tail -n1)
[ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_month" "$f_histfile"*.csv 2>/dev/null | tail -n1)
set -x
[ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_hour" "$f_histfile"*m.csv 2>/dev/null | sort | tail -n1)
[ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_day" "$f_histfile"*h.csv 2>/dev/null | sort | tail -n1)
[ -z "$f_line" ] && f_line=$(egrep "^$f_currency_date_month" "$f_histfile"*.csv 2>/dev/null | sort | tail -n1)
[ -n "$f_line" ] && f_rate=$(echo "$f_line" | cut -d, -f2)
set +x
f_reverse=false
if [ -n "$f_rate" ]
then