in reply to Trailing spaces to lines less than x characters

How about

perl -ne'chomp; printf "%-76s\n", $_' infile > outfile

Updated to correct silliness. Question: why do you need to append spaces to the end? That seems very impracticle ... spaces are usually prepended to such strings.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)

Replies are listed 'Best First'.
Re^2: Trailing spaces to lines less than x characters
by davido (Cardinal) on Jun 05, 2015 at 18:46 UTC

    That should be...

    perl -lne 'printf "%-76s", $_' infile > outfile

    ...otherwise the spaces will get appended after the newline on each existing line, and then another newline will be appended after that.

    Also in-place editing could look like this:

    perl -lni.bak -e 'printf "%-76s", $_' infile

    Dave