fmt: How to skip some text?

Bill Campbell linux-sxs
Mon May 17 11:54:10 PDT 2004


On Sat, Sep 27, 2003, Joel Hammer wrote:
>I want to use fmt in vi to format text, eg:
>          :1,$ ! fmt -w 130
>
>Without vi, this command would look like:
>          cat file ! fmt -w 130
>
>I want it to format everything except lines which begin with at least
>two blanks, like this:

Extend your command to pipe it through sed first:

This will format the entire document
Go to the top of the document (1G);
!Gsed '/^  /d' | fmt -w 130<ENTER>

Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

More laws, less justice.  -- Marcus Tulius Ciceroca (42 BD)


More information about the Linux-users mailing list