I am trying to search and replace certain pattern "\x" to REPLACE_counter. Where counter goes from $0$ to $N$. The text is
\x & \x & \x & \x & \x \\ \cline{1-1}
\x & \x & \x & \x & \x \\ \cline{1-1}
I found the next command
let i=1 | g/\\x/.,.s//\='REPLACE_'.i/ | let i=i+1
but it only works for the first match in each line, i.e. I get
REPLACE_1 & \x & \x & \x & \x \\ \cline{1-1}
REPLACE_2 & \x & \x & \x & \x \\ \cline{1-1}
How can I modify that command to get
REPLACE_1 & REPLACE_2 & REPLACE_3& REPLACE_4& \xREPLACE_5 \\ \cline{1-1}
REPLACE_6 & REPLACE_7 & REPLACE_8 & REPLACE_9 & REPLACE_10 \\ \cline{1-1}