[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed, line range, inclusive/exclusive

From: Paul Jarc
Subject: Re: sed, line range, inclusive/exclusive
Date: Tue, 06 Apr 2004 10:17:49 -0400
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (gnu/linux)

Jim Easton <address@hidden> wrote:
> This came up for the umpteenth time when I was trying to sift
> email messages which contain, among a lot of other stuff, several
> sets of lines begining with "Received:" and followed by lines
> begining with a "tab"  I would like to delete (or select them
> for some sort of substitution) that group of lines without
> necessarily deleting the following non-tab line.

# If it's a continuation line, append it to the hold space and move on.
/^[     ]/{H;d;}
# Otherwise, it's the beginning of a new field.  Exchange the hold
# space with the pattern space, so we can work with the previous,
# now-complete field, and leave the beginning of the new field in the
# hold space where it can be appended to until it's complete.
# handle Received: lines...
# handle non-Received: lines...
# Distinguishing the message header from the body is left as an
# exercise for the reader.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]