Loading ...
Sorry, an error occurred while loading the content.

84633Re: regexp to identify N duplicates parts into several lines

Expand Messages
  • epanda
    Nov 4, 2007
    • 0 Attachment
      Hi Andy,

      the command hich works : g/\%(^\1;.*\n\)\@<!\_^\([^;]*\);.*\(\n\1;.*\)\
      +$/exe "norm! \"AyV//e\r"

      Your command works very well but could I have a detailed explaination
      cause I have never used registers out of default registers ?

      You have resolved a big part of my problem, in fact I would like to do
      sdiff an store the results of files of the same name (not the same
      checksum).
      NowI have the list sorted by name and I know for example that I have
      to do 2 diff between 3 files of the same name which have several
      basename and not the same checksum.

      Thanks
      epanda




      On 1 nov, 13:50, Andy Wokula <anw...@...> wrote:
      > Ben Schmidt schrieb:
      >
      >
      >
      > >> g/\(^[^/]\+;\)\(.*\n\)\(\(^\1\)\(.*\n\)\)\{1,\}/t$
      >
      > >> This regexp search highlights correctly the three first lines because
      > >> there is three times sortie.cpp,
      > >> it highlights the three lines after because there is three sortie.h
      > >> but it does not copy all highlighted at the end of the file.
      >
      > > As documented, :g only runs its command on the first line of multi-line matches.
      >
      > > You will need to do something a bit more complicated.
      >
      > > I would suggest:
      >
      > > 1. Clear some register, say "a. :let @a=""
      >
      > > 2. Make the :g command append each match to that register using yank:
      >
      > > :g/\(^[^/]\+;\)\(.*\n\)\(\(^\1\)\(.*\n\)\)\{1,\}/exe "normal \"Ay//e\<CR>"
      >
      > :g/\%(^\1;.*\n\)\@<!\_^\([^;]*\);.*\(\n\1;.*\)\+$/exe "norm! \"AyV//e\r"
      >
      > > 3. Move to the end of your buffer and put the register. :$put a
      >
      > > Hope this helps!
      >
      > > Ben.
      >
      > --
      > Andy


      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Show all 8 messages in this topic