P is for Practical | |
PerlMonks |
Trailing spaces to lines less than x charactersby mlsmit10 (Initiate) |
on Jun 05, 2015 at 16:30 UTC ( [id://1129225]=perlquestion: print w/replies, xml ) | Need Help?? |
mlsmit10 has asked for the wisdom of the Perl Monks concerning the following question:
Hi all,
I'm a novice to perl, and I'm wondering if there is a way to add trailing spaces to all lines in a file that are less than x characters long in perl. I can do this in bash using the line: awk '{printf("%-76s\n", $0)}' infile > outfile Where 76 is the number of characters I need to be in each line. I want to add this to a longer perl script. I'm sure there's an easy way to translate this into perl executable language, but I don't know it. Any help will be much appreciated!
Back to
Seekers of Perl Wisdom
|
|