develooper Front page | perl.beginners | Postings from October 2009

for output from other unix commands

Thread Next
From:
Harry Putnam
Date:
October 8, 2009 12:29
Subject:
for output from other unix commands
Message ID:
87skdtu1kv.fsf@newsguy.com

I'm just looking for a push to get started... I do have some perl
skills (pretty lowlevel to be sure) so can do basic formating with
printf and such.

But here... I expect my input to be pretty uniform actually already
formatted ok. Except, 1 or 2 lines somewhere in the input that will be
longer and make reading the output a bit of a chore.

I want to catch those long lines and format them like one might format
a news/mail message... wrapped at column 72 or so but also indented 
whatever spcs looks good.

I looked at perldoc -f format but that says its about pictures and
doesn't appear to be intended to format text.

Imagine input like:

some        var=setting        otherinfo        otherinfo2
some        var=setting, that , is way longer than any thing else in the history of mankind        otherinfo        otherinfo2
some        var=setting        otherinfo        otherinfo2
-------        ---------       ---=---       ---------      -------- 

The `var=setting' with all the baloney should be wrapped but still end
up with the last 2 elements lined up like the other lines:

some        var=setting        otherinfo        otherinfo2
some        var=setting, that , is way longer than any 
            thing else in the history of mankind 
                               otherinfo        otherinfo2
some        var=setting        otherinfo        otherinfo2



Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About