I can print my array elemets using echo in a loop, but the output format is really bad . there I tried injecting tab but there is just a lot of spaces between the elements ssince each element length is different. I have no idea how to use printf ? I tried , but it just not working properly. is there a way to format my printf or echo so I have equal number of spaces between each element? This is driving me mad.
while [[ $counter -lt $nai ]];
do
#echo ${slist[$counter]} $'\t' ${sstate[$counter]} $'\t' $'\t' ${scached[$counter]}
printf ${slist[$counter]} $'\t' ${sstate[$counter]} $'\t' $'\t' ${scached[$counter]}
counter=$(( $counter + 1 ))
done
IN short I just want to print my elements in a format with equal number of spaces between the elements like this
abc cdf efg
What i'm getting is
abc cdf efg
Thanks