On Thu, March 8, 2012 13:45, Alessandro Antonello wrote:
> Hi, all.
>
> I have a file with the following output:
>
> pass1 key: 9534 1CFF A92D 76B9 B52C 79E5 1D10 85E5
> pass2 key: 6C66 D635 3922 1D99 6FCE 8366 7992 C3DE
> passN key: F906 930C 2FD3 6B4B 7A2C 1AF5 C314 D62C
>
> There are several of that 3 lines. I could ':sort' the file to find
> duplicated
> lines but, what I really need to know is if there are binary data of
> 'pass1
> key' equal to 'pass2 key' or 'passN key'. I have 3 files with more than
> 8000
> lines each. So, visually do this is tedious and error prone. I need a
> little
> help, please.

Put the following into ~/.vim/plugins/dupes.vim
fu! s:Duplicates()
    let res={}
    for line in range(1,line('$'))
        let key=matchstr(getline(line), '^[^:]*: \zs.*$')
        let key = '\('.key.'\)'
        let res[key] = get(res, key) + 1
    endfor
    call filter(res, 'v:val > 1')
    call matchadd('TODO', join(keys(res), '\|'))
endfu
com! Dupes :call s:Duplicates()

And then restart Vim and call :Dupes which should highlight
all duplicates.

regards,
Christian

-- 
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Reply via email to