Assume that I have a file named in.txt:
$ cat in.txt
a
b
a
c
a
d
I only want to replace the a\nc with deleted, but not a\nb or a\nd.
$ sed -e ':loop # create a branch/label named `loop`
$!{
N # append the next line of input into the pattern space
/\n$/!b...