Hi ping!

On Do, 14 Jun 2012, ping wrote:

> see I want to extract certain line from following text, and only
> display those lines for me.
> usually I use :global to do that job and it works fine.
> but the specialty here is, I want to search "across" lines:
> I want to get ONLY lines containing either of these:
> 
>    "classifier-group"
>    OR
>    xxx packets, xxx bytes
> 
> where xxx can be any NUMBERS.
> 
> so I use this after visual selection:
> 
> :'<,'>g/classifier-group\_.\{-}\d\d* packets, \d\d* bytes
> 
> but I only get these:
> :'<,'>g/classifier-group\_.\{-}\d\d* packets, \d\d* bytes


I am not sure I understand, which of 2 different problems you are trying 
to solve. If you wish to print lines containing either
"classifier-group" or "xxx packets, xxx bytes" use something like this 
command:
:g/classifier-group\|\d\d* packets, \d\d* bytes


Or if you want to print lines from the "classifier-group" line until the 
next matching line "xxx" packets, xxx bytes", use this command:

:g/classifier-group/.,/\d\d* packets, \d\d* bytes/p

(Which boils down to on each line matching classifier-group" print from 
there until the next line, matching '\d\d packets, \d\d bytes' using the 
:p command.)


regards,
Christian
-- 
Der Mensch ist nicht geboren, frei zu sein,
und für den Edlen ist kein schöner Glück,
als einem Fürsten, den er ehrt, zu dienen.
                -- Johann Wolfgang von Goethe (Torquato Tasso)

-- 
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