procmail
[Top] [All Lists]

Re: Matching repeating lines?

1997-02-10 17:06:47
On Mon, 10 Feb 1997 15:48:17 -0600 (CST) dattier(_at_)wwa(_dot_)com (David W.
Tamkin) wrote:

:0bf
| sed -e '$!N' -e '/\(<.*>\)\n.*\1/!P' -e D

That's *still* assuming that the chevrons are literal.  (Since the
right-side angle bracket is anchored to the embedded newline, "[^>]*"
for the 
text between the angle brackets wasn't needed; ".*" will do.)

That was my fault for not making the example clearer.  The chevrons are
*not* literal; the message text is completely free form.  However, using
your sed expression as an example, I came up with:

sed -n -e '$!N' -e '/[^ ]*  *[^ ]*  *[^ *]  *[^ ]*  *\(.*\)\n.*\1/!P'

The '-n' (suppress default output) makes the '-e D' on the end
unnecessary (the output is identical, and I'm assuming that the two
expressions are syntactically the same).  That ugly regexp skips the
first 4 fields, and then saves the remaining text in \1.

Of course, I've only tested it on one a single example, so no guarantees
:-).

-- Lars

---
Lars Kellogg-Stedman * lars(_at_)bu(_dot_)edu * (617)353-8277
Office of Information Technology, Boston University

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