I have a file which contains word 'name' multiple times ( 250 times ). I need to replace every instance of 'name' with its count attached to it as name_1, name_2, name_3....name_250.Can I do this using sed ?What flags I need to use ?
Replace word instances with its count attached to it
text processing;sed
A job for perl:perl -pe 's/\bname\b\K/_.++$n/ge'