Roy Rapoport thanked David Hunt and added,
| (and having more examples is always a good thing also)
OK, here's another way to get a complete copy of the head (you'll probably
get "From " changed to ">From ", but you'll usually want that) prepended to
the body:
:0hf
* conditions if any
| sed -e 1h -e 1!H -e /./b -e G
After that, if you filter the head again, you'll affect only the first copy
(which is the head now; the second copy is part of the body). It has the
advantage of not requiring a temporary file nor a shell, but it has the dis-
advantage that it will blow up if the size of the head exceeds the maximum
hold space your version of sed can handle (usually about 5K).
Here's another, but it may require that the entire head fit into $LINEBUF:
:0hfi # remember that H is implicit
* conditions if any
* ^^\/(.*$)+
| echo "$MATCH" ; echo "$MATCH"