SOME IMPORTANT VIM COMMANDS

dd - delete or cut line

yy - copy line

p - paste

n lines

ndd

nyy

search:

/Serchword -  top to bottom

?Searchword - bottom to top

$ - end of the line

^ - start of the line

:$ - end of the file

:n -  n th line

J - (merge)joining lines

u -undo changes

clear && cat <file> | grep searchword

 numbers appear and disappear

se nu

se nonu

replace patterns

1,$s/127.0.0.1/43.242.124.85

1 st word in the line will substitute. to substitute it globally

1,$s/127.0.0.1/43.242.124.85/g

ignore cases

1,$s/127.0.0.1/43.242.124.85/gi

undo changes - u

cat -n <filename> | grep [456]

cat -n <filename> | egrep "4|5|6"

whereever 4,5,6 in the no's of a line will output it

delete lines

:1,3d

:1,5d

search a pattern and cotaining line delete

:1,$g/zabbix/d

delete everything to the current line

:1,.g/pattern/d