(3) vim commands to replace
I don't know of any "vi" option to search and replace only for the first 30 occurrences. But you may try the following:
The above "vi" command will replace in lines starting from 1 to 5.
This will basically promt you before replacing. But it doesn't seem to give you a count.
You may also refer (you may search and download with this name) "doc_a4m.pdf"