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[@]}")
|
g_csv_array=("${g_csv_array_ref[@]}")
|
||||||
|
|
||||||
# go reverse through array
|
# go reverse through array
|
||||||
|
declare -Ag v_csv_array_associative
|
||||||
|
declare -Ag v_csv_array_associative_reverse
|
||||||
l=0
|
l=0
|
||||||
for (( r=${#g_csv_array[@]}-1 ; r>=0 ; r-- ))
|
for (( r=${#g_csv_array[@]}-1 ; r>=0 ; r-- ))
|
||||||
do
|
do
|
||||||
@ -67,7 +69,8 @@ function g_read_csv {
|
|||||||
#declare -g v_${l}_${g_headline_item}="${g_csv_line_array[i]}"
|
#declare -g v_${l}_${g_headline_item}="${g_csv_line_array[i]}"
|
||||||
# last line to vars without number
|
# last line to vars without number
|
||||||
[ "$l" = 0 ] && declare -g v_${g_headline_item}="${g_csv_line_array[i]}"
|
[ "$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++))
|
((i++))
|
||||||
done
|
done
|
||||||
((l++))
|
((l++))
|
||||||
|
Loading…
Reference in New Issue
Block a user