GOAL

* search a string using vi

* search and replace a string using vi


1. to search a string in vi

command

/<string> (without < and >)


example, open addr.txt file using vi


command

vi addr.txt


find 'game' string

command

/game


2. to search and replace a string in vi

command

:%s/string/new_string/g


%s means subtitute


example, find 'good' and replace with 'bad'

command

:%s/good/bad/g