I have 203 instances of the word ubuntu in a file, and I want to replace each one with UBUNTU_X, where X is an incrementing counter. In other words, the original file is:ubuntu xxxxxxxx ubuntu xxxxxxxx ubuntu xxxubuntuxxx xxxubuntu ubuntuxxxxxx ...And I want to replace it with:UBUNTU_1 xxxxxxxx UBUNTU_2 xxxxxxxx UBUNTU_3 xxxUBUNTU_4xxx xxxUBUNTU_5 UBUNTU_6xxxxx ... The last occurrence must be UBUNTU_203
How to replace each occurrence of a string with an incrementing counter in vim?
vim