sed on html pages

Silvio Siefke <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Hello,

i use static website generator and so i clean with tidy the page. But 
tidy make some mistakes and i think with sed is the way easy to fix it.

The empty lines i delete with sed -i '/^$/d' index.html, the div i delete
with sed -i 's|<[/]\?div[^>]*>||g' index.html. But i found not a way i can
break line and insert 4 steps of whitespace.

Before:

  <title>Silvio Siefke | Blog</title><!--[if lt IE 9]>
      <script src="/static/js/html5.js" type="text/javascript"></script>
    <![endif]-->  
  <link href="/static/css/style.css" rel="stylesheet" type="text/css">

After:

  <title>Silvio Siefke | Blog</title>

    <!--[if lt IE 9]>
      <script src="/static/js/html5.js" type="text/javascript"></script>
    <![endif]-->  

  <link href="/static/css/style.css" rel="stylesheet" type="text/css">

How can i relize?

Can i combined all step, delete empty line, delete div, id="ext", id="vid"
and this break line?


Thank you for help & Nice Day
Silvio
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.