I'd like to replace 'x' in this file with current line number. That is, change
x
x
x
to
1
2
3
For now, I use a Perl one-liner:
perl -pi -e '$x=$.; s/x/$x/' myfile.txt
I think UltraEdit can do it with a vertical select and replace. Can this be done in vim? (My example here assumes 'x' is all there is on one line. But the lines in my real file are much more complicated.)