mlsmit10 has asked for the wisdom of the Perl Monks concerning the following question:
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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Trailing spaces to lines less than x characters
by toolic (Bishop) on Jun 05, 2015 at 16:32 UTC | |
|
Re: Trailing spaces to lines less than x characters
by Tux (Canon) on Jun 05, 2015 at 20:09 UTC | |
|
Re: Trailing spaces to lines less than x characters
by jeffa (Bishop) on Jun 05, 2015 at 16:45 UTC | |
by davido (Cardinal) on Jun 05, 2015 at 18:46 UTC | |
|
Re: Trailing spaces to lines less than x characters
by AnomalousMonk (Archbishop) on Jun 05, 2015 at 17:49 UTC | |
|
Re: Trailing spaces to lines less than x characters
by aaron_baugher (Curate) on Jun 05, 2015 at 18:59 UTC |