Translate

Archives

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