Tuesday, July 15, 2014

gvim tricks

1. remove duplicate lines

sort all lines and remove duplicates (keeping unique lines):
:sort u

2. run vi script

vi -e try.txt

3. delete all lines containing pattern

:g/pattern/d

4. delete all lines without the pattern

:v/pattern/d

No comments:

Post a Comment