I have an array, on the attached screen.
I need to get all third components from this array.
Example (my existing array):
array1 =
["SRV WW ZSTG HSM BlackDuck RW", "SRV WW ZSDB M204 BlackDuck RW", etc]
The result should be:
array2 = ["HSM", "M204"]
- I need to delete all empty elements from array
My code to work with it right now:
FILE="$1"
index=0
while read name; do
get_group_names_from_file[$index]="$name"
index=$(($index+1))
done < "${FILE}"
get_group_names_from_file=("${get_group_names_from_file[@]:3}")
for ((a=0; a < ${#get_group_names_from_file[*]}; a++))
do
echo "${get_group_names_from_file[$a]}"
done