LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Vim - string replacement from current position to end of file (https://www.linuxquestions.org/questions/linux-general-1/vim-string-replacement-from-current-position-to-end-of-file-858275/)

armandino 01-24-2011 02:52 AM

Vim - string replacement from current position to end of file
 
What is the vim command I have to use when I want to perform a text substitution not on the current line or on the whole document or on lines from number x to number y but just from the current cursor position down to the end (or up to the beginning) of the document?

Snark1994 01-24-2011 03:12 PM

Code:

:.,$s/pattern1/pattern2/g
to end of document.
Code:

:1,.s/pattern1/pattern2/g
from start of document. "." is considered to be the current line number.
Hope this helps :)


All times are GMT -5. The time now is 01:50 AM.