[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pr command



-snip-
> So my question is how to use pr (or some other text reformating 
> program) to add margins to my text output (for printing).
> 
> The pr -o command works nicely but when I print long lines the
> text efter the linebreak will not be indented. Like this:
> 
>         This is a very long line that will now be cut by the printer and print on the
> next line without being indented.
> 

Sorry to answer my own mail but here is one quick solution I hacked in gawk.

gawk '{
match($0,/$/)
if (RSTART>=75){
        printf("%5s%s\n"," ",substr($0,1,75))
        printf("%5s%s\n"," ",substr($0,76))
        }
else printf("%5s%s\n"," ",$0)
}' $1 | pr -f 


A solution without needing awk/gawk/perl etc would be nice.

Best regards
Joakim Svensson


Reply to: