[SLL] left and right justified text

Jay Scherrer jay at scherrer.com
Mon May 12 11:00:41 PDT 2008


Paul A. Franz, P.E. wrote:
> I can display text using more than one word processor formatted with a monospace font
> that is justified left and right but I haven't been able to save the resulting text
> formatted. I have tried configuring a text printer writing to file and the formatting
> is lost. I have tried saving to a file as text, same thing.
> 
> I thought maybe vim could do it. Not so, it's a line editor mostly.
> 
> Does anyone know of a utility other than lex that can do it?
> 
> I want it for formatting the text for use man pages to look nice and for formatting
> comments in script files and programs.
> 
> 
Have you tried using Perl's built in "format" for creating formated text 
files? It's very useful as I use it primarily to write payroll checks.
@ = beginning location
< = Left justified
 > = right justified
Example:
#!/usr/local/perl
format STOUT =
@<<<<<<<<<<<@<<<<<<<<<<<@>>>>>>@>>>>>>>>>>>>>>>>
$firstName   $lastName   $ID      $position
.
$firstName = "Joe";
$lastName = "Tester";
$ID = "0045";
$position = "Software Tester";
write;

-- 
Jay Scherrer
Scherrer Company
Bookkeeping and Tax services
office: 206.701.7952
cell:     206.478.1658
<http://jay.scherrer.com>



More information about the linux-list mailing list