regex - sed remove trailing space after bracket -


i trying remove trailing space after brackets in html file using sed (part of shell script on centos):

from this:

<p>some text ( <em>text should not break new line</em>). more text.</p> 

to this:

<p>some text (<em>text should not break new line</em>). more text.</p> 

i can in sublime text \(\s regex , replacing bracket not work in sed.

i have tried:

sed 's/[(]\s*$/(/' sed 's/[(]\s*$\n/(/' 

and many other things, none of them work.

any ideas?

try:

sed ':a;/($/{n;s/\n//;ba}' file 

if line ends (, appends next line (n) pattern space , substitutes newline character \n nothing, thereby joining lines. done in loop (ba jumps label a).


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -