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

Re: grep -o

Expand Messages
  • Charles E Campbell
    ... That s pretty good -- you know, you could eliminate a lot of backslashes if you used single quotes: let @a= |g/ab +a/let
    Message 1 of 9 , Jul 2, 2004
    • 0 Attachment
      gumnos (Tim Chase) wrote:

      >Okay, how's this for a 2nd stab?
      >
      > let @a='' | g/foo/let
      >@a=@...(getline(line('.')),".\\{-}\\(".@/."\\)\\(\\%(".@/."\\)\
      >\@!.\\)*","\\1\n",'g')
      >
      >(again all one bletcherous line) I think this grabs all instances on a
      >line, assuming they don't overlap.
      >
      >
      >
      That's pretty good -- you know, you could eliminate a lot of backslashes
      if you used single quotes:
      let @a=''|g/ab\+a/let
      @a=@...(getline(line('.')),'.\{-}\('.@/.'\)\(\%('.@/.'\)\@!.\)*','\1\n','g')

      When applied to
      aba afa abba acca abbba ada abbbba

      and doing "ap after executing the above command yields:
      aba
      abba
      abbba
      abbbba

      which looks ok to me!

      Regards,
      Chip Campbell
    Your message has been successfully submitted and would be delivered to recipients shortly.