I was trying to find out if it is possible to give an ex command a list of lines instead of a range?
:h :range it doesn't seem possible to use a list of numbers as a range.
I think that what you are looking for is the global command (
:h :global) which applies a command on the lines matching a pattern.
If you look at
:h /ordinary-atom you will see that
\%Xl allows you to match the line number
X. So for example if you have the following buffer:
foo bar fizz fuzz
And you want to replace
F on the first line you can do:
And if you want to do it on the first and third line: