I need to parse a stream which may contain line continuations,
and I want to view the continued lines as individual lines. I came
up with:

sed ' /\\$/N; s/\\\n/ /; tp; '


This seems like such a common requirement, that I figure
there surely must be a more canonical/simple way to do it.
Any ideas?

(Sample run of my script, demonstrating most
of the cases I care about. Note that trailing spaces
do not constitute a line continuation:
$ cat input
line 1
line 2 \
continued
line 3 \
continued \
further
\
start of continued line
$ sed ' /\\$/N; s/\\\n/ /; tp;' input
line 1
line 2 continued
line 3 continued further
start of continued line

--
William Pursell