Jakob Kofoed wrote:
>
> I have a file looking like (where \n is new line):
>
> blabla\n
> blablablablablabla\n
> blablablablablablablablablabla\n
> blabla\n
>
> but I need every line to have 80 characters - in this case filled with white
> space.
>
> I can figure out how to do it when I have the same character number in every
> line - but when the lines changes in length - I'm lost!!
>
> The output should look like:
>
> blabla
> \n
> blablablablablabla
> \n
> blablablablablablablablablabla
> \n
> blabla
> \n
>
> I would appreciate any suggestions or hints.

Hi Jakob.

If you 'chomp' the newline from the end of the input records and
the output them using

  printf "%-80s\n", $record;

then they will be printed with space padding to the right up to
eighty characters.

HTH,

Rob



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to