vi
commands that I keep forgetting every now and then. My favourite is busybox vi
, and I have extensively tested all commands below. They should work in whatever vi you might use. I assume, by inference, all others are supersets of busybox vi
. If not, please let me know.G | jump to end of file |
gg 1G :0 | jump to beginning of file |
5G :5 | jump to line number 5 |
d$ D | delete to end of line |
d0 d^ | delete to beginning of line |
:.,$d | delete to end of file |
:1,.d | delete to beginning of file |
:g/pattern/d | delete all lines containing the string "pattern" |
:g!/pattern/d :v/pattern/d | delete all lines not containing the string "pattern" |
:1,$s/pattern1/pattern2/g | search & replace all "pattern1" with "pattern2" |
No comments:
Post a Comment