I need to create an array from the first line of a file like:
a;b;c
d;e;f
g;h;i
In this instance, the array should be (a,b,c). How do I do that?
I need to create an array from the first line of a file like:
a;b;c
d;e;f
g;h;i
In this instance, the array should be (a,b,c). How do I do that?
var=
a;b;c
d;e;f
g;h;i
arr=($(awk -F\; 'NR==1 {$1=$1;print}' var))
echo ${arr[1]}
b
echo ${arr[*]}
a b c