Thanks for the replies bluescreen and Scrutinizer. Scrutinizer your code is prettier than mine, I'm going to use it
OK .. so I got the same results with your two code snippets.
I started to wonder if maybe I had a line-feed in my file name variable so I used sed to strip out the last character. NOPE .. that was not it!
I found the problem when I referenced the numerical array element instead of using the $COUNTER variable. What I finally figured out was that $COUNTER did indeed count all the elements of my arrays .... BUT the array elements begin with 0 ... ie array1[0]. So all this time I was trying to print out an array element that did not exist the first time thru the loop.
Solution: decrement the #COUNTER before beginning the loop
COUNTER=${#array1[*]}
COUNTER=COUNTER-1
while [ $COUNTER -ne -1 ]; do
echo -n $JUNOS_FILE | awk '{ printf "%-20s" , $0 }'
echo ${array0[$COUNTER]} | awk '{ printf "%-20s" , $1 }'
echo ${array3[$COUNTER]} | awk '{ printf "%-50s" , $0 }'
echo ${array2[$COUNTER]} | awk '{ printf "%-20s \n" , $1 }'
let COUNTER=COUNTER-1
done