1 |
Hello. How can I line-wrap a text file that was not wrapped before (e.g. |
2 |
like text file created on Microsoft Windows's notepad, the software does |
3 |
softwrap by default, thus the file created using it often have very long |
4 |
text lines) by using command pipe? |
5 |
|
6 |
I could use vim, activate some formatting options and use gq. But that |
7 |
couldn't be used on a pipe. |
8 |
|
9 |
I could use groff, but that command line looks too complicated: |
10 |
|
11 |
$ head -n1 max_payne | groff -Tutf8 | grep --invert-match ^$ |
12 |
Life was good. A house on the Jersey side across the river. The |
13 |
smell of freshly cut lawns. The sounds of children playing. A |
14 |
beautiful wife and a baby girl. The American dream come true. But |
15 |
dreams have a nasty habit of going bad when you’re not looking. |
16 |
|
17 |
|
18 |
Besides groff wraps not according to the console term width, but |
19 |
according to the paper size in /etc/paper. It would be nice to have |
20 |
something wrap my text by using console width (what you get with '$ stty |
21 |
-a | head -n1') |
22 |
|
23 |
-- |
24 |
Real Softservice |
25 |
|
26 |
Huateng Tower, Unit 1788 |
27 |
Jia 302 3rd area of Jinsong, Chao Yang |
28 |
|
29 |
Tel: +86 (10) 8773 0650 ext 603 |
30 |
Mobile: 159 1111 7382 |
31 |
http://www.realss.com |