Hi,
I am new to scripting and need help splitting a string using space as the delimiter.
How can I do that?
I want the result to be stored in an Array.
I tried using
set -A arr $(echo $FILE)
echo $arr[0]
The result of the above was '[0]'.
Thanks.
Consider reading a tutorial on korn shell arrays.
echo ${arr[1]}
references array element number 1, for example
There is no need to use the echo command
$ str="the big brown fox"
$ set -A arr $str
$ print ${arr[0]}
the
$ print ${arr[3]}
fox
$ print ${arr[@]}
the big brown fox
$ print ${#arr[@]}
4
$