public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] how to word-wrap using a pipe?
@ 2008-10-20  1:13 zhangweiwu
  2008-10-20  2:30 ` meino.cramer
  2008-10-20  3:19 ` paulcol
  0 siblings, 2 replies; 6+ messages in thread
From: zhangweiwu @ 2008-10-20  1:13 UTC (permalink / raw
  To: gentoo-user

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




^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [gentoo-user] how to word-wrap using a pipe?
@ 2008-10-20  3:38 djanderson
  0 siblings, 0 replies; 6+ messages in thread
From: djanderson @ 2008-10-20  3:38 UTC (permalink / raw
  To: gentoo-user



Zhang Weiwu wrote:
> 
> 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 think you'll find what you're looking for in the 'fmt' standard unix
command. `man fmt', it's part of coreutils.

-Doug

-- 
View this message in context: http://www.nabble.com/how-to-word-wrap-using-a-pipe--tp20061899p20062130.html
Sent from the gentoo-user mailing list archive at Nabble.com.




^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <boRBg-I6-9@gated-at.bofh.it>]

end of thread, other threads:[~2008-10-22 13:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-20  1:13 [gentoo-user] how to word-wrap using a pipe? zhangweiwu
2008-10-20  2:30 ` meino.cramer
2008-10-20  3:19 ` paulcol
2008-10-21 11:01   ` Neil Bothwick
  -- strict thread matches above, loose matches on Subject: below --
2008-10-20  3:38 djanderson
     [not found] <boRBg-I6-9@gated-at.bofh.it>
     [not found] ` <boTD6-3il-5@gated-at.bofh.it>
     [not found]   ` <bpnhS-7Pt-33@gated-at.bofh.it>
2008-10-22 13:41     ` zhangweiwu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox