Re: repair comb-quoting

"[email protected] [sed-users]" <[email protected]> 21 Jan 2016 22:59:35 -0800
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
---In [email protected], <maillists-yahoo@...> wrote :
 > 
 > so once i fix this comb-quoting by joining those
> dangling words from short lines to the previous line
> then a reformatting of the paragraph does it all. :)
 > 
> Sven 
 > 
 

 A preliminary version of the comb de-quoter is as implemented below:
 

 sed -e '
    # to un-quote comb quotes in a mailer
    # v1.0
 

    # uncited lines
    /^>/!{x; /./p; s/.*//; x; b;}
 

    # cited lines below this
    /^>.\{1,30\}$/{
       # minor line = line length <= 30
       x
       /^>.\{50\}/{
          # major line = line length >= 50
          G; s/\n>//; x; s/.*//; x
       }
       b
    }
    x;/./p;d
 '
 

 and as a one-liner for incorporation in your mailer setup:
 

 sed -e '/^>/!buncited' -e '/^>.\{30\}./bbigcited' -e 'x;/^>.\{50\}/!b' -e 'G;s/\n>//;x;s/.*//;x;b' -e ':bigcited' -e 'x;/./p;d' -e ':uncited' -e 'x;/./p;s/.*//;x'

 

 HTH.
 -Rakesh

 




[Non-text portions of this message have been removed]