procmail
[Top] [All Lists]

Re: Removing extra spaces while preserving indents

2002-06-24 03:10:14
On Sun, 23 Jun 2002, Dan Kohn wrote:

The following is a .procmailrc that takes an HTML email message with
[...]
The issue is that Lynx produces indents of 3 characters normally and 5
for blockquotes, but then double justifies the text, producing a bunch
of extraneous spaces. My regex gets rid of the spaces.  The following
works, but it seems like there must be a more elegant solution:

| lynx -dump -force_html -stdin \
| sed -e 's/^\ \ \ \ \ /bigindent/' \
| sed -e 's/\ \+/\ /g' \
| sed -e 's/^\ /\ \ \ /g' \
| sed -e 's/^bigindent/\ \ \ \ \ /'

What I want is something like:

    sed -e '/\^[   |     ]/s/\ \+/\ /g'


        It is not clear what do you want (for me anyway) it can help
        if you add an example of input and output required.
        However, if you want to shrink the spaces:

tr -s ' ' ' '

        If the indents are important try the command expand(1) if you
        have it in your system, it converts multy spaces to tabs or
        tabs to spaces:

        I think the you have extra "\" that make the script looks
        not elegant.

Bye,
 Udi

_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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