Formatting program's output

2001-09-22 Thread Frederik Vanrenterghem
Hi,

I'd like to make a signature with 2 columns, a static and a variable one.
I'll use signify for this purpose. Unfortunately, it doesn't handle
fortune's output as desired.

I would need to find a way to limit the number of characters per line
fortune supplies. (Preferably by starting a new line on spaces of
course, and not in the middle of a word).

Any ideas how I could accomplish this?

Thanks in advance!

-- 

Ginsburg's Law:
At the precise moment you take off your shoe in a shoe store, your
big toe will pop out of your sock to see what's going on.



Re: Formatting program's output

2001-09-22 Thread Romain Lerallut
Thus spake Frederik Vanrenterghem on Sat, Sep 22, 2001 at 05:57:46PM +0200:
 Hi,
 
 ...
 
 I would need to find a way to limit the number of characters per line
 fortune supplies. (Preferably by starting a new line on spaces of
 course, and not in the middle of a word).
 
 Any ideas how I could accomplish this?

I think fold(1) from textutils should do what you want:

$ echo 'abcdefghijklmnopqrstuvwxyz' | fold --width=10
abcdefghij
klmnopqrst
uvwxyz

and between words too:
$ echo 'Two households, both alike in dignity, In fair Verona where we
lay our scene...' | fold -s --width=16

Two households, 
both alike in 
dignity, In 
fair Verona 
where we lay 
our scene...


 Thanks in advance!

HTH,
Romain


-- 
I've been on this lonely road so long,
Does anybody know where it goes,
I remember last time the signs pointed home,
A month ago.
-- Carpenters, Road Ode