| First, I would like to forward a copy of e-mails that contain a certain
| keyword within the message body to an alphanumeric pager. I subscribe to a
| weather warning notification service and wish to forward only messages that
| contain, within the body, the name of my county.
No problem at all. Use the capital-B flag on the recipe, or if it has other
conditions that must search the head or the entirety, use the B ?? modifier
on the condition that searches for the county name.
This is the current recipe that I wish to improve upon. It sends ALL weather
warnings in my region to my pager:
Is this how I would add/nest the additional condition of checking the body of
message for my county name?
| Second, after identifying such a message, I want to delete from the
| copy any paragraphs that do not begin with an asterisk. These paragraphs
| the ones containing the pertinent info, and since my pager is limited to
| about 200 characters I need to remove the extraneous stuff.
A lot depends on the specifics; are the paragarphs separated by blank lines?
Is the asterisk at the start of a pargraph flush against the left margin or is
it indented? Are there other asterisks in the text?
If the asterisks are flush left and there is an empty line between each two
| sed '/^\*/,/^$/!d' # or, sed -n '/^\*/,/^$/p'
The format appears to be that the asterisk is used as the "bullet" character of
paragraph, with all subsequent paragraph text indented. Perhaps your second
below would be better because of this? All of the text I want to delete is
consistently ahead of the first occurence of an asterisk.
| sed '/\*/,$ !d' # or, sed -n '/\*/,$ p'
So, would my completely modified recipe look like this?
| sed '/\*/,$ !d'
Unfortunately, I will have to wait for severe weather to see if it works!