Using SED: Match RegEx pattern in multiple lines and combined the lines into sinlge line

gunnalag@GMD /cygdrive/c/Gunnalag/MyFiles

$ grep -i -A1 -B1 “topbar.*” movie0715.html

 

<div id=”topbar”>

<h2>Ragada&nbsp;&nbsp;<small><i></i></small>&nbsp;(December 24, 2010)&nbsp;&nbsp;&nbsp;<a href=#comment><small>Write A Comment</small></a></h2>

src=”../pagead2.googlesyndication.com/pagead/show_ads.js”>

</script>                       </div> <!– End Of topbar –>

<div id=”outer5″>

 

gunnalag@GMD /cygdrive/c/Gunnalag/MyFiles

$ cat movie0715.html | sed -E -n ‘/”topbar”/{N; s/n//; p;}’

<div id=”topbar”>                           <h2>Ragada&nbsp;&nbsp;<small><i></i></small>&nbsp;(December 24, 2010)&nbsp;&nbsp;&nbsp;<a href=#comment><small>Write A Comment</small></a></h2>

 

gunnalag@GMD /cygdrive/c/Gunnalag/MyFiles

$

Leave a Reply

Your email address will not be published. Required fields are marked *