The vi editor is a screen-oriented text editor that supports regular expressions for pattern matching and character substitution. Vim which stands for "Vi IMproved" is a clone of vi and recognizes similar commands.
If you want to replace or insert characters at the beginning of a line,
the line beginning is represented by the
caret character, i.e.,
^
(Shift-6 on a standard computer keyboard), and line
endings are represented by the
dollar sign character,
i.e., $
.
E.g., the following quote has three occurences of the word "us". If I wanted
to replace only the "us" at the end of the line with "ourselves", I could hit
the colon key while not in vi's insert mode, which would give me a colon prompt
and then enter s /us$/ourselves/
which would replace the occurence
of "us" at the end of the lne with "ourselves".
What lies behind us and what lies before us are tiny compared to what lies within us
~ Ralph Waldo Emerson
[ More Info ]