From the course: Cert Prep: LPIC-1 Exam 101 (Version 5.0)

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Search and replace in Vim

Search and replace in Vim - Linux Tutorial

From the course: Cert Prep: LPIC-1 Exam 101 (Version 5.0)

Start my 1-month free trial

Search and replace in Vim

- [Presenter] Searching and replacing text in VIM is quite easy. Let's start VIM with a new text file by typing in vim, space, searchfile.txt and hitting enter. Let's go into insert mode by pressing I and then adding some text. I'm going to add line one, line two, line three, line four, and then the last line I'm going to type in line space line and hit enter. Let's move our cursor to the top of the file. To search from your current position to the end of the document, exit insert mode by pressing escape, press forward slash to search, and then start typing. I'm going to search for the word four and hit enter. If you want to search from your current position towards the beginning of the document, then press the question mark and start typing. So I'm typing in question mark three and hitting enter. Let's search for something that we have more than one of like the word line. Escape, forward slash, line, hit enter.…

Contents