I'd like to insert the line
<hr />
above every occurrence of a header 2 line in a file - e.g., above this pattern
<h2>variable pattern here</h2>
So the above should become
<hr />
<h2>variable pattern here</h2>
How can I do this with Vim, Sed or Perl?
vim way:
cmd :g/<h2>/normal O<hr />
will do the job.
see it here: (I took the example from sudo_O)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With