Tom Adler gave us a sample, explaining,
| I would like to keep the original intact, and only filter the pager forwarded
| copy.
OK, good. Then that's what we'll do.
[excerpt quoted flush left between rows of equal signs]
= = =
WIC111-082340-
BULLETIN - IMMEDIATE BROADCAST REQUESTED
SEVERE THUNDERSTORM WARNING
NATIONAL WEATHER SERVICE MILWAUKEE/SULLIVAN WI
544 PM CDT TUE JUN 8 1999
THE NATIONAL WEATHER SERVICE IN MILWAUKEE/SULLIVAN HAS ISSUED A
* SEVERE THUNDERSTORM WARNING FOR...
SAUK COUNTY IN SOUTH CENTRAL WISCONSIN
* UNTIL 640 PM CDT
* AT 544 PM CDT...NATIONAL WEATHER SERVICE DOPPLER RADAR INDICATED
A SEVERE THUNDERSTORM NEAR LONE ROCK...MOVING EAST NORTHEAST AT
20 MPH.
* THE SEVERE THUNDERSTORM WILL BE NEAR...
BEAR VALLEY AT 547 PM CDT
PLAIN AT 555 PM CDT
SPRING GREEN AT 600 PM CDT
DAMAGING WINDS AND LARGE HAIL ARE LIKELY. GO INSIDE A STURDY
BUILDING AND STAY AWAY FROM WINDOWS!
= = =
Uh oh. Are you sure you don't want the "damaging winds and hail" paragraph?
If it's likely to show up past the 200th character, though, you won't get it
anyway.
But now we know that the bulleting asterisks are flush left and that the
paragraphs are separated by empty lines. So,
:0Dc: # file an unfiltered copy in the inbox
* ^From: Wx4u
* B ?? SAUK($| )+COUNTY
$DEFAULT # or wherever you want to store the original
savemetas=$SHELLMETAS # it won't be that kind of asterisk
SHELLMETAS
:0Afb # filter and forward the original
| sed -n '/^\*/,/^$/p'
:0A
! pager(_at_)pagercompany(_dot_)net
SHELLMETAS=$savemetas
Here's another approach:
:0Dc # filter and forward a clone, let later recipes handle the original
* ^From: Wx4u
* B ?? SAUK($| )+COUNTY
{
savemetas=$SHELLMETAS # it won't be that kind of asterisk
SHELLMETAS
:0fb
| sed -n '/^\*/,/^$/p'
:0
! pager(_at_)pagercompany(_dot_)net
SHELLMETAS=$savemetas # in case of fall-through
}