On Wed, Sep 26, 2007 at 08:27:34PM +0000, Oleg Verych wrote: > 26-09-2007, Celejar: > > On Wed, 26 Sep 2007 09:47:09 -0500 > > Martin McCormick <[EMAIL PROTECTED]> wrote: > > > >> I remember reading about a UNIX utility whose name > >> escapes me. You feed it ASCII text and it breaks lines as near > >> to a desired length as possible without splitting words. Anyone > >> remember the name of this utility? > > > > fmt -w nnn? > > Yesterday, when i was (quickly) reviewing (very long) backlog of this > ML, there was similar question, but person started subject with `sed`. > > Eventually the sed solution to the problem was not noticed, and this > silly `fmt` was accepted. > > Just in case somebody is interested in sed scripting, i'd like to share > with little one, which i used to format `pdftotext` output. I didn't come > up with good distribution algo for justification, though. > > <ftp://flower.upol.cz/upload/sed-craziness> > > Main usage was to read defprogramming.pdf by Ulrich Drepper in my hackish > non-X environment. But such docs, with silly 2 columns text, are coming out > very broken. But some formatting for C in sed, is rather useful. > > Ah, "silly fmt?", you might say. Yes. It doesn't break line-long > words. I do this like that: > " > barfoobarbarfoobarbarfoobarbarfoobar\ > barfoobarbarfoobar" > > :P
Just to toss out another alternative, while I use fmt a lot, par does some things better, or at least easier. In particular, it can reformat a paragraph while retaining leading characters, e.g., quoted text in emails. It my not handle your runaway foobar example very well, though: $ echo barfoobarbarfoobarbarfoobarbarfoobarbarfoobarbarfoobar | par -w 40 barfoobarbarfoobarbarfoobarbarfoobarbarf oobarbarfoobar -- Ken Irving, [EMAIL PROTECTED] -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]