Imagine I have a file like this:
INSERT INTO table VALUES('1','<p><em>The lazy fox jumps again</em></p>bunch of other html<p><em>Is the lazy fox crazy?</em></p>')
INSERT INTO table VALUES('2','<p><em>The lazy fox jumps again</em></p>bunch of other html<p><em>Is the lazy fox crazy?</em></p>')
INSERT INTO table VALUES('3','<p><em>The lazy fox jumps again</em></p>bunch of other html<p><em>Is the lazy fox crazy?</em></p>')
And I wish to delete only the first occurrence of <p><em>
and </em></p>
so I end up with something like this:
INSERT INTO table VALUES('1','The lazy fox jumps againbunch of other html<p><em>Is the lazy fox crazy?</em></p>')
INSERT INTO table VALUES('2','The lazy fox jumps againbunch of other html<p><em>Is the lazy fox crazy?</em></p>')
INSERT INTO table VALUES('3','The lazy fox jumps againbunch of other html<p><em>Is the lazy fox crazy?</em></p>')
... how can I do that with sed (or perl)? The statement...:
sed "1,/INSERT INTO/s/<p><em>//g"
... only replaces the first occurrence in the file, not on every line.
Help is much appreciated.