Sunday, 8 September 2013

Duduplication based on line prefixes in vim

Duduplication based on line prefixes in vim

I have a file created by find, like this...
./a/b/c/d/f.x
./a/b/c/e/shao.tnh
./a/b/c/e/ehn.he
./a/b/f/g/h
./a/b/u
I need to browse through it, but it's extremely large.
Is there any way to, say, have my cursor on the c in line 1, then have
some sort of macro scan from cursor to beginning of line, output that
scanned section to some log file, then go down a line and delete that line
if it matches the scanned prefix pattern, ie ^./a/b/c, then repeat the
process until it gets to a line that doesn't match?
In other words, I would press one key, to, in this case, delete the first
three lines of the file, and possibly append the line "./a/b/c/" to a
seperate logfile.
Ideally, I'd also have a macro that skips to the next line that doesn't
have the prefix without modifying anything.
Thanks!

No comments:

Post a Comment