You can use a
for
loop to split the string at white spaces and ignore the "-------" matches:
data="rep ------- zip ------- mnt ------- mnt ------- 952230"
declare -a arr
count=0
for i in $data; do
if [ "$i" != "-------" ]; then
arr[count]=$i
count=$count+1
fi
done
echo ${arr[*]}
Note that I have used
$data
as variable name because
$PATH
is a predefined
bash variable.