nmh-workers
[Top] [All Lists]

Re: [nmh-workers] post 1.71 ug: "long line"/single newline paragraphs

2018-05-26 06:04:43
Hi Tom,

    sed 's/$/\n/' "$@" |

Another idiom is: sed -eG.

Oh yes, that's better.

    fmt -su |

Interesting switches for fmt.

Well, I thought you could play around with what you prefer.
It's GNU fmt, which has annoying behaviour.  Bring back _Software Tools_!

    $ yes foo | fmt -60 | uniq -c | sed 3q
         67 foo foo foo foo foo foo foo foo foo foo foo foo foo foo
          3 foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo
         67 foo foo foo foo foo foo foo foo foo foo foo foo foo foo
    $ 

The `-u' doesn't turn `foo. Bar' into two spaces, just shortens multiple
spaces to one or two, unfortunately.  On the other hand, `e.g.  gripper'
would then need fixing up.

    $ fmt -u
    Apple   banana  cherry.    Doughnut  eclair.
    ^D
    Apple banana cherry.  Doughnut eclair.
    $ 

I've ~/bin/owpl, one word per line, and fmt does know to use two spaces
when joining lines of different sentences.

    $ owpl | fmt
    Distinct. Lack. Of. Spaces.
    ^D
    Distinct.  Lack.  Of.  Spaces.
    $ 

    cat -s

This can be sed too, and it irks to be using an option to cat(1)  :-)
But I go for ease over recall.

-- 
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy

-- 
nmh-workers
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>