What does this command line that starts with "1, $" do in Vim?
I have a shell script created by someone else which I am currently trying to understand and there is a line in it which is
vim -c "1,\$s/MAJOR_VERSION = ./MAJOR_VERSION = $1/" -c "1,\$s/MINOR_VERSION = .*/MINOR_VERSION = $2/" -c "wq" $f
I know what it does is change MAJOR_VERSION = .
to my input ($1
), but I don't understand what the
"1, \$s
at the beginning means. The corresponding vim command from terminal would be
:\s/MAJOR_VERSION...
etc, so what does the $s do in this case?
1,$
defines the range on which your substitute command s/../../
is applied. 1,$
means 'from the first to the last line'. See :help range
in Vim for more.