Question: Here is my code to insert table rows dynamically. It's not working with ie7. But working with ie8, ie9 ,Chrome, Firefox.

```
for (var lvl=0;lvl<13;lvl++) {
  $("#check-form tbody").append( "<tr />");                 
  for (var fchr=6;fchr<=36;fchr+=3) {
    if (fchr==6)
      $("#check-form tbody").append( "<th scope=\"row\">"+hpa[lvl]+" MB</th>");                 
    $("#check-form tbody").append("<td><input type=\"checkbox\" value="+('0'+fchr).slice(-2)+"_"+hpa[lvl]+" id="+('0'+fchr).slice(-2)+"_"+hpa[lvl]+" class=\"chkChart\"></input></td>");
  }
}

```

What am I doing incorrectly?

Answer: 
It's not quite there, it prints a leading newline for some reason, but maybe something like this? 

```
$ sed -n '/<td class="time">/,/<\/td>/{s/^<td class="time">$//;/^<\/td>$/d;p}' file 

13.05.2013  17:51

```

Inspired by <https://stackoverflow.com/a/13023643/1076493>

**Edit:** Well, there's always perl!  

For more info see <https://stackoverflow.com/a/1213996/1076493>

```
$ perl -0777 -ne 'print "$1\n" while /<td class="time">\n  (.*?)\n<\/td>/gs' regex.txt 
13.05.2013  17:51

```
How fixed is your format? If you're sure it's going to look like that then you can use `sed` to match the first line, get the next line and print it, like this: 

```
$  sed -n '/<td *class="time">/{n;p}' test
  13.05.2013  17:51

```

You could add something to cover the case where it's on the same line as well. Alternatively pre-process the file to strip all the newlines, maybe collapse the whitespace too (can't be done with `sed` apparently) and then go from there. 

However, if it's an HTML file from somewhere else and you can't be sure of the format I'd consider using some other scripting language that has a library to parse XML, otherwise any solution is liable to break when the format changes. 

Edited to add a link to my favorite sed resource for this sort of thing:<http://www-rohan.sdsu.edu/doc/sed.html>