Replace only the Nth match

Here is another practical task. We need to replace only the second or following match in each file. For example, we want to insert <a name="..."> tags before the second and any subsequent headers in each HTML file. There are multiple headers in each file: And we want to insert a name to be able to refer to each header. The final result should look like this (the added tag is bold): <a…