I have found this in the documentation.
n = 1; {x, x, a, b, x, x, c, d} /. x :> n++
Just what I need!
Thanks