Hello. How can I line-wrap a text file that was not wrapped before (e.g.
like text file created on Microsoft Windows's notepad, the software does
softwrap by default, thus the file created using it often have very long
text lines) by using command pipe?

I could use vim, activate some formatting options and use gq. But that
couldn't be used on a pipe.

I could use groff, but that command line looks too complicated:

$ head -n1 max_payne | groff -Tutf8 | grep --invert-match ^$
Life was good. A house on the Jersey side across the  river.  The
smell  of  freshly  cut  lawns. The sounds of children playing. A
beautiful wife and a baby girl. The American dream come true. But
dreams  have  a nasty habit of going bad when you’re not looking.


Besides groff wraps not according to the console term width, but
according to the paper size in /etc/paper. It would be nice to have
something wrap my text by using console width (what you get with '$ stty
-a | head -n1')

-- 
Real Softservice

Huateng Tower, Unit 1788
Jia 302 3rd area of Jinsong, Chao Yang

Tel: +86 (10) 8773 0650 ext 603
Mobile: 159 1111 7382
http://www.realss.com


Reply via email to