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
$
Tell me more
×
Server Fault is a question and answer site for
professional system and network administrators. It's 100% free, no registration required.
|
|
|||
|
|
|
Give this a try:
The result:
Notice that both instances of Edit: Fixed a problem with deleting the wrong lines. |
|||||||||||
|
|
Would piping it into |
|||||
|
