It's extremely straightforward.
What have you tried?
In reply to Re: Numbering instances of a String in a file by ikegami in thread Numbering instances of a String in a file by Anonymous Monk