Here I’m mentioning all the commands related to Vi and Vim editor that I learn
Command to delete all lines in Vi Editor:
:1,$d
Delete a single line where the cursor is
dd
Find and /replace
:%s/find_word/replace_word/g
To search a word that has the character forward slash / or any special characters then simply include backward slash \ before that \/
:%s/find\/words\~/replacewords/g
Add Text to beginning of every line – use ˆ
Add Text to end of every line- use $
:%s/ˆ/text/ :%s/$/text/
Remove Blank Lines
:g/^$/d
Remove Blank Lines that contains space
:g/^ *$/d