Gentoo Archives: gentoo-user

From: meino.cramer@×××.de
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] how to word-wrap using a pipe?
Date: Mon, 20 Oct 2008 02:30:27
Message-Id: 20081020023021.GC6111@solfire
In Reply to: [gentoo-user] how to word-wrap using a pipe? by zhangweiwu@realss.com
1 Hi
2
3 ...just a shot in the dark: Try 'fmt' (UNIX standard too so no extra
4 install I think).
5
6 Kind regards,
7 Meino Cramer
8
9
10
11 zhangweiwu@××××××.com <zhangweiwu@××××××.com> [08-10-20 03:52]:
12 > Hello. How can I line-wrap a text file that was not wrapped before (e.g.
13 > like text file created on Microsoft Windows's notepad, the software does
14 > softwrap by default, thus the file created using it often have very long
15 > text lines) by using command pipe?
16 >
17 > I could use vim, activate some formatting options and use gq. But that
18 > couldn't be used on a pipe.
19 >
20 > I could use groff, but that command line looks too complicated:
21 >
22 > $ head -n1 max_payne | groff -Tutf8 | grep --invert-match ^$
23 > Life was good. A house on the Jersey side across the river. The
24 > smell of freshly cut lawns. The sounds of children playing. A
25 > beautiful wife and a baby girl. The American dream come true. But
26 > dreams have a nasty habit of going bad when you’re not looking.
27 >
28 >
29 > Besides groff wraps not according to the console term width, but
30 > according to the paper size in /etc/paper. It would be nice to have
31 > something wrap my text by using console width (what you get with '$ stty
32 > -a | head -n1')
33 >
34 > --
35 > Real Softservice
36 >
37 > Huateng Tower, Unit 1788
38 > Jia 302 3rd area of Jinsong, Chao Yang
39 >
40 > Tel: +86 (10) 8773 0650 ext 603
41 > Mobile: 159 1111 7382
42 > http://www.realss.com
43 >
44 >
45
46 --
47 Please don't send me any Word- or Powerpoint-Attachments
48 unless it's absolutely neccessary. - Send simply Text.
49 See http://www.gnu.org/philosophy/no-word-attachments.html
50 In a world without fences and walls nobody needs gates and windows.