Subject: Re: Headers in body? (Pt. 2)

From: [email-masked] (David W. Tamkin)
Date: Sat, 16 Jul 1994 16:32:45 -0500 (CDT)

Peter Stark clarified his question:

| Sendto: tester
| 
| Hi there...How do I search for a like just like I have written above? 
| It has to be in the body of the message though.
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You didn't say that before.  To egrep the body, you must use the 'B' flag.

| I just tried the following and it did not work.
| 
| :0 bw
| * [email-masked]
| * ^Sendto:.*chris
| ! [email-masked]

'b' means "pipe or save only the body."  'h' means "pipe or save only the
header."  'hb' cancel each other out and is the default: pipe or save the
entire text.

I think you probably want to keep the header there and shouldn't use 'b'.

But 'H' and 'B' are different.  'B' means "egrep only the body."  'HB'
means "egrep the entire text."  'H' alone is the default and means "egrep
only the header."  Since the Sendto: line will be in the body, you'll never
find it without the 'B' flag.

If it is safe to search the entire text for the From: pattern, then you
can do this:

  :0HBw
  * [email-masked]
  * ^Sendto:.*chris
  ! [email-masked]

If there is a risk of false positives because of From's in the body or
Sendto's in the header, you need to do this:

  :0
  * [email-masked]
  {
   :0Bw
   * ^Sendto:.*chris
   ! [email-masked]
  }

| From: "David W. Tamkin" <[email-masked]> suggested the following:
| >You mean it must be exactly like that with nothing after it on the line?

And note that I admitted I was trying to guess what Peter's first rendition
of the question really meant!

| >Just use a condition like this:
| >
| >   * ^Sendto: tester$
| 
| How does that differ, (besides the fact that the $ is the end of line) 
| from the * ^Sendto:.*chris I had before? What does the .* do? And if that 
| is the case, I don't understand how the from I have above works. It isn't 
| searching for the exact line or my exact email address but that is what 
| it is doing. Also, I thought that the ^^ double caret is for headers in 
| the file or body. What should I do?

1. It differs in that it anchors at the end of the line, which wasn't what
   you were after, and in that, like the "^Sendto: tester" sample you gave
   in the first letter, it requires that the colon and the name of the tester
   be separated by exactly one space rather than just having to occur on
   the same line.
2. .* means "any string of zero or more characters except newlines."
3. ^^ matches only at the beginning of the first line of the header or,
   if you use 'B' without 'H', the beginning of the first line of the body.
4. What should you do?  Punt.

David W. Tamkin  P. O. Box 3284  Skokie IL  60076-6284
[email-masked]   MCI Mail: 426-1818   +1 312 714 5610