read csv files to vars
This commit is contained in:
parent
6f7bbfd2a7
commit
a9008c7c26
@ -56,6 +56,8 @@ function g_read_csv {
|
||||
g_csv_array=("${g_csv_array_ref[@]}")
|
||||
|
||||
# go reverse through array
|
||||
declare -Ag v_csv_array_associative
|
||||
declare -Ag v_csv_array_associative_reverse
|
||||
l=0
|
||||
for (( r=${#g_csv_array[@]}-1 ; r>=0 ; r-- ))
|
||||
do
|
||||
@ -67,7 +69,8 @@ function g_read_csv {
|
||||
#declare -g v_${l}_${g_headline_item}="${g_csv_line_array[i]}"
|
||||
# last line to vars without number
|
||||
[ "$l" = 0 ] && declare -g v_${g_headline_item}="${g_csv_line_array[i]}"
|
||||
v_csv_array_associative[${g_headline_item}_${l}]="${g_csv_line_array[i]}"
|
||||
v_csv_array_associative[${g_headline_item}_${r}]="${g_csv_line_array[i]}"
|
||||
v_csv_array_associative_reverse[${g_headline_item}_${l}]="${g_csv_line_array[i]}"
|
||||
((i++))
|
||||
done
|
||||
((l++))
|
||||
|
Loading…
Reference in New Issue
Block a user