Just trying to format some text with fmt, making paragraphs look nice
and all. But, I want fmt to skip lines beginning with tabs (lists).

Here is an example of the kind of text I am working with (ignore the
lines):

=========================================
The first part of this paragraph
needs to be joined to this second and
third line.

        List
                One
                Two
                Three
==========================================

The output should look like this:

==========================================
The first part of this paragraph needs to be joined to this second and
third line.

        List
                One
                Two
                Three
============================================


fmt says that the -p string will skip lines beginning with string.  So,
I ran this document through sed and put NOTAB at the front of everyline
not beginning with a tab, like so:

==========================================
NOTABThe first part of this paragraph
NOTABneeds to be joined to this second and
NOTABthird line.

        List
                One
                Two
                Three
===========================================

Then, I put it through this command:
1,$ ! fmt -w 130 -pNOTAB
The output was this:

==============================================
NOTABThe first part of this paragraph needs to be joined to this second and third line.

List
One
Two
Three
================================================
This is not good. It looks like fmt is stripping out the leading white
space on paragraphs it is supposed to be skipping.

I can get around this by running the text twice through sed. Putting a
non-white character(s) in front of the tabs in the list protects them
from being removed, but, this looks a like a bug in fmt.

Any ideas appreciated.

Joel

_______________________________________________
Linux-users mailing list
[EMAIL PROTECTED]
Unsubscribe/Suspend/Etc -> http://mail.linux-sxs.org/mailman/listinfo/linux-users

Reply via email to