The command :%s/foo/bar/gc is to replace all foo by bar in the global field with confirmation. There are many foos in my file within first 50 lines not to be changed. How can make this command effective only for lines 51 to last line?Thanks!
How to replace patterns after line k
command line;replace
The find and replace command has a range option. In this case you are performing this action against the entire document %. You can also select a more specific range. So lets say you want to swap lines 51 through 57:51,57s/foo/bar/gcIf you want to go to end of the document use $:51,$s/foo/bar/gcPer :h rangeLine numbers may be specified with:             :range E14 {address}        {number}        an absolute line number        .               the current line                          :.        $               the last line in the file                 :$        %               equal to 1,$ (the entire file)            :%        't              position of mark t (lowercase)            :'        'T              position of mark T (uppercase); when the mark is in                        another file it cannot be used in a range        /{pattern}[/]   the next line where {pattern} matches     :/        ?{pattern}[?]   the previous line where {pattern} matches :?        \/              the next line where the previously used search                        pattern matches        \?              the previous line where the previously used search                        pattern matches        \&              the next line where the previously used substitute                        pattern matches        