Para tarefas de processamento de texto, sugiro usar algo como Awk ou Perl no lugar de bash
, por exemplo,
perl -lnE '
push @a, $_; $max = length $_ > $max ? length $_ : $max
}{
foreach $x (@a) {say $x, ", ", "."x($max - length $x)}
' file
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., ...............