Translate

Image of Beginning Google Maps API 3
Image of Linux Kernel Development (3rd Edition)
Image of Operating System Concepts
Image of Advanced Programming in the UNIX Environment, Second Edition (Addison-Wesley Professional Computing Series)

Advanced Seaching in vi

The / and ? search commands in vi search forward and backward respectively from the current line. Sometimes, however, you may wish to search forwards or backwards from a particular line number or find the nth occurrence of a regular expression (RE).

The commands:

:line/RE
:line?RE


will search forward and backward, respectively, for the RE starting from the line number line.

Another useful facility in vi is the ability to find the nth occurrence of an RE starting at the current line. The commands:

nth/RE
nth?RE


will search forward and backward, respectively, for the nth occurrence of the RE starting from the current line.

Comments are closed.