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"

Reply via email to