Talk:Fmt

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computing (Rated Stub-class)
WikiProject icon This article is within the scope of WikiProject Computing, a collaborative effort to improve the coverage of computers, computing, and information technology on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Stub-Class article Stub  This article has been rated as Stub-Class on the project's quality scale.
 ???  This article has not yet received a rating on the project's importance scale.
 
Note icon
This article has been automatically rated by a bot or other tool as Stub-Class because it uses a stub template. Please ensure the assessment is correct before removing the |auto= parameter.

the text has been improved

Differences between fold and fmt with respect to wrapping lines?[edit]

For example, using fold and fmt to wrap some text:

$ cat text 
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur
dignissim venenatis pede. Quisque dui dui, ultricies ut, facilisis non,
pulvinar non, purus. Duis quis arcu a purus volutpat iaculis. Morbi id
dui in diam ornare dictum. Praesent consectetuer vehicula ipsum.
Praesent tortor massa, congue et, ornare in, posuere eget, pede.
$ fold --spaces --width=50 text 
Lorem ipsum dolor sit amet, consectetuer 
adipiscing elit. Curabitur
dignissim venenatis pede. Quisque dui dui, 
ultricies ut, facilisis non,
pulvinar non, purus. Duis quis arcu a purus 
volutpat iaculis. Morbi id
dui in diam ornare dictum. Praesent consectetuer 
vehicula ipsum.
Praesent tortor massa, congue et, ornare in, 
posuere eget, pede.
$ fmt --width=50 text 
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Curabitur dignissim venenatis
pede. Quisque dui dui, ultricies ut, facilisis
non, pulvinar non, purus. Duis quis arcu a purus
volutpat iaculis. Morbi id dui in diam ornare
dictum. Praesent consectetuer vehicula ipsum.
Praesent tortor massa, congue et, ornare in,
posuere eget, pede.

The output is quite different. Using cat to have a look where each line ends:

$ fold --spaces --width=50 text | cat --show-ends
Lorem ipsum dolor sit amet, consectetuer $
adipiscing elit. Curabitur$
dignissim venenatis pede. Quisque dui dui, $
ultricies ut, facilisis non,$
pulvinar non, purus. Duis quis arcu a purus $
volutpat iaculis. Morbi id$
dui in diam ornare dictum. Praesent consectetuer $
vehicula ipsum.$
Praesent tortor massa, congue et, ornare in, $
posuere eget, pede.$
$ fmt --width=50 text | cat --show-ends
Lorem ipsum dolor sit amet, consectetuer$
adipiscing elit. Curabitur dignissim venenatis$
pede. Quisque dui dui, ultricies ut, facilisis$
non, pulvinar non, purus. Duis quis arcu a purus$
volutpat iaculis. Morbi id dui in diam ornare$
dictum. Praesent consectetuer vehicula ipsum.$
Praesent tortor massa, congue et, ornare in,$
posuere eget, pede.$

What about with text that wasn't already wrapped:

$ cat text
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Curabitur dignissim venenatis pede. Quisque dui dui, ultricies ut, facilisis non, pulvinar non, purus. Duis quis arcu a purus volutpat iaculis. Morbi id dui in diam ornare dictum. Praesent consectetuer vehicula ipsum. Praesent tortor massa, congue et, ornare in, posuere eget, pede.
$ fold --spaces --width=50 text | cat --show-ends
Lorem ipsum dolor sit amet, consectetuer $
adipiscing elit. Curabitur dignissim venenatis $
pede. Quisque dui dui, ultricies ut, facilisis $
non, pulvinar non, purus. Duis quis arcu a purus $
volutpat iaculis. Morbi id dui in diam ornare $
dictum. Praesent consectetuer vehicula ipsum. $
Praesent tortor massa, congue et, ornare in, $
posuere eget, pede.$
$ fmt --width=50 text | cat --show-ends
Lorem ipsum dolor sit amet, consectetuer$
adipiscing elit. Curabitur dignissim venenatis$
pede. Quisque dui dui, ultricies ut, facilisis$
non, pulvinar non, purus. Duis quis arcu a$
purus volutpat iaculis. Morbi id dui in diam$
ornare dictum. Praesent consectetuer vehicula$
ipsum. Praesent tortor massa, congue et, ornare$
in, posuere eget, pede.$

The output is still different, so fold and fmt do quite different wrappings of text. Could be shown. — Preceding unsigned comment added by 178.128.249.231 (talk) 17:15, 3 July 2012 (UTC)

Added example directly to Fold_(Unix) 173.63.95.40 (talk) 01:57, 30 December 2013 (UTC)