======vi======
[[http://www.sm.luth.se/csee/courses/smd/139/smd139_vi.pdf|vi Editor "Cheat Sheet" (pdf)]] (dead link) \\
[[http://thomer.com/vi/vi.html|Vi Lovers Home Page]] \\
[[http://ss64.com/vi.html|SS64 - The vi editor (visual editor) - A quick reference guide]] \\
[[http://www.theregister.co.uk/Print/2003/09/11/bill_joys_greatest_gift/|The Register - Bill Joy's greatest gift to man – the vi editor]] \\
=====Search and replace text in entire document=====
Replace all occurrences of the word "old" with "new":
:1,$s/old/new/
Source:[[http://www.kingcomputerservices.com/unix_101/search_and_replace_with_vi_part_1.htm|Search and replace with vi -- part 1]] \\
To replace text with slashes:
:1,$s;/var/backups/;/backup/once/;
To replace all occurrences of the string on the same line add a 'g' as suffix of the command.
Example:
:1,$s;/var/backups/;/backup/once/;g
=====Delete lines matching pattern=====
:1,$g/lines containing this text will be deleted/d
Source:[[https://alvinalexander.com/blog/post/linux-unix/how-search-delete-lines-vi-vim-editor/|alvin alexander - A vim pattern search and delete example]]