2012/3/8 Tim Chase <v...@tim.thechases.com>: > On 03/08/12 06:45, Alessandro Antonello wrote: >> >> 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. > > > If you don't mind changing the file-order, I'd sort it, then use a regexp to > find the duplicate lines: > > :%sort /key: / > /^.*\(key: .*\)\n.*\1$ > > It's a little easier to spot if you turn on search highlighting > > :set hls > > which should then highlight them all. > > It's a lot uglier & slower if you want to leave the file unsorted because it > has to check every line with every subsequent line. > > It might look something like > > /^.*\(key: .*\)\ze\n\%(.*\n\)*.*\1$ > > It was fast on my dummy 5-line file using your data above (duplicating one > line and changing the pass#, along with a blank line), but I suspect it > would get progressively slower as your file grows. > > -tim > >
Hi, all. Thanks a lot for your help. I think I solved the problem, with your help, off course. Please, correct me if I'm wrong. I used the Reid Thompson idea to sort and filter the file removing duplicated pass1, pass2 and passN values. The I used the Tim Chase search regex to find any remaining duplicates differentiated only by the "pass" type. The search found nothing! What is a good thing because I cannot have the same value for different passes. Thanks a lot! -- 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