I'm trying to write a recipe that'll search across multiple lines of a
body, grab the found piece, and store it to a file as a single line
with the newlines removed (or replaced)
I can do this for a single line:
----
:0 bfW:parsed.errors
|egrep "^.*string I want"
:0 a:
| formail -I "" >> procmail.parsed
----
What I can't do is extend this to a second line:
Original string:
This is my key string:
this is the data I want.
Here's an awk script that will do something like this:
#! /usr/bin/gawk -f
# twoliner.awk -- usage: twoliner > output.file
/key string/ { l=$0; getline; print $l, $0 }
Note: this should find all lines that contain
your "key string" regular expression, saves
that line in the variable named 'l' (ell),
gets the next line, and prints both (separated by
the default ORS which is just a space).
So, how can I look for "key string", and stuff both lines into a file
on one line? Unfortunately, changing the format of the incoming mail
isn't possible.