Saturday, February 1, 2014

Re: regular expression blindness

On 2014-02-01 12:41, meino.cramer@gmx.de wrote:
> Hi,
>
> sorry, this may be a very stupdi question (tm) but...
>
> I try to find an error-line in a very longis tar output log
> (and do later some editing with it). By the way...I am doing this
> on Linux...:)
>
> Except for the error reporting line all lines start with '\.\/' but
> I dont know it contents. Searching for 'error' gives me be far to
> many hits from regular files (listed in the log).
>
> So...I am trying to find any line NOT starting with '\.\/' (dot
> slash).
>
> I can invert a singe character with [^c] (meaning anything not 'c')
> and I can NOT find alternatives...
>
> But how can I NOT find a sepecific sequence of characters at the
> beginning of a line?

You have a couple options that occur to me:

1) if you can delete the content, just use :v instead of :g making it

:v/^\.\//d

2) if you just want to search, you can use the more complex pattern

/^\(\.\/\)\@!

which asserts that the stuff in the \(...\) is not fount ("\@!") at
the beginning of the line.

-tim



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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: