insert sequential numbers into a string using regex/grep/sed/awk
<p>Does anyone know how use regex/grep/sed/awk to insert sequential numbers into a string? I have a long <code>.xhtml</code> document (using BBEdit to edit) with lots of plain <code>&lt;p&gt;</code> tags, and I want to transform them to <code>&lt;p id="0001"&gt;</code>, <code>&lt;p id="0002"&gt;</code>, etc.</p>