Try this code:
#!/bin/bash
# This loop is to count the number of bytes per line, then it will find the max number of bytes over all the lines
max=$(cat datafile| while IFS=IFS=" " read line; do echo "${line}" | wc -c; done | sort -k 1.1n | tail -n1)
cat datafile| while IFS=IFS=" " read line; do
# Count of bytes in every line
n=$(echo "${line}" | wc -c)
# bytes difference in every line
diff=$(echo $((${max}-${n})))
# complete the number of bytes per line to the max number of bytes over all the lines.
dash=$(printf %"${diff}"s | tr " " ".")
# print results
echo ${line},${dash}
done
output:
Unix was ,.....................
originally meant ,.............
to be a ,......................
co,...........................
nvenient p,...................
latform for progra,...........
mmers developing software to,.
be run on it and on other ,....
systems, rather than for non-,
programmers.,.................
[7][8] The system grew larger,
as the operating system star,.
ted spreading in a,...........
cademic circ,.................
les, as users add,............
ed their own tools to th,.....
e system and shared them wi,..
th colleagues.,...............