sed to remove next 15 lines after pattern in Solaris

Team,

I am trying to use sed to delete 15 lines, after pattern patch, which includes the pattern as well in Solaris. I used the below command, as we do it Linux, but it's not working as expected in Solaris.

I am getting the error as "garbled".

sed '/\/table/,+15d' status.html
sed: command garbled: /\/table/,+15d

Any help would be really appreciated.

For example, below are the lines, and I need to delete the lines from </table> , till table border='1' width='90%' align='center' summary='Script output'>

...........................................
...........................................
...........................................
09-JAN-2018 02:00
</td>
<td align="right">
       211
</td>
<td>
SYNC
</td>
</tr>
</table>
<p>

</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<meta name="generator" content="SQL*Plus 11.2.0">
<style type='text/css'> body {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} p {font:10pt Arial,Helvetica,sans-serif; color:black; background:White;} table,tr,td {font:10pt Arial,Helvetica,sans-serif; color:Black; background:#f7f7e7; padding:0px 0px 0px 0px; margin:0px 0px 0px 0px;} th {font:bold 10pt Arial,Helvetica,sans-serif; color:#336699; background:#cccc99; padding:0px 0px 0px 0px;} h1 {font:16pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; border-bottom:1px solid #cccc99; margin-top:0pt; margin-bottom:0pt; padding:0px 0px 0px 0px;-
} h2 {font:bold 10pt Arial,Helvetica,Geneva,sans-serif; color:#336699; background-color:White; margin-top:4pt; margin-bottom:0pt;} a {font:9pt Arial,Helvetica,sans-serif; color:#663300; background:#ffffff; margin-top:0pt; margin-bottom:0pt; vertical-align:top;}</style><title>SQL*Plus Report</title>
</head>
<body>
<p>
<table border='1' width='90%' align='center' summary='Script output'>
<tr>
<td>
PROD
</td>

SO, the output should be something like this.

09-JAN-2018 02:00
</td>
<td align="right">
       211
</td>
<td>
SYNC
</td>
</tr>
<td>
PROD
</td>
.................................
.................................
.................................

Please let me know if you need more details.

Please wrap your code, files, input & output/errors in CODE tags.

It works fine for me (CentOS6) but perhaps mine is not too strict on the command formation. As a first stab, do you perhaps need a space between +15 and d ?

Robin

Hi Robin,

Thank you for the response.

Please note that I do not have space between +15 and d.

Regards,
Nagaraj R.

The Solaris sed man page doesn't mention the "incremental" second address (as opposed to e.g. FreeBSD or linux)

So, you meant to say, I can not achieve, what I am looking for using sed

/usr/xpg4/bin/sed '/\/table/,+15d' status.html

Hi rdrtx1,

Nope. The below is not working, as expected.

/usr/xpg4/bin/sed '/\/table/,+15d' status.html

Is variable SUN_PERSONALITY set? If so, unset variable and try sed again.

try also splitting the script. something like:

sed -e '/\/table/{}' -e '//,+15 d' status.html

The +15 requires GNU sed.
But perhaps you better match the next HTML tag anyway, that's easy with a standard sed

sed '/<\/table>/,/<table.*>/ d' status.html