The two "sed lines" only differ by a "\n" below..
How can i get this output [no new line before the </pre>
]? [ http://pastebin.com/raw.php?i=ED34jvtF ]:
.
.
something3
</pre>
something4
.
.
$ echo -e 'something1\nsomething2\nsomething3\n\n</pre>\nsomething4\nsomething5'; echo "######################################"; echo -e 'something1\nsomething2\nsomething3\n\n</pre>\nsomething4\nsomething5' | sed -e N -e N -e "s#\n</pre>#</pre>#g" -e P -e D
something1
something2
something3
</pre>
something4
something5
######################################
something1
something2
something3</pre>
something4
something5
$
$ echo -e 'something1\nsomething2\nsomething3\n\n</pre>\nsomething4\nsomething5' | sed -e N -e N -e "s#\n</pre>#\n</pre>#g" -e P -e D
something1
something2
something3
</pre>
something4
something5
$
Give this a try:
The result:
Notice that both instances of
</pre>
are on a line by themselves without a preceding blank line.Edit: Fixed a problem with deleting the wrong lines.