Sunday, September 15, 2013

Delete lines not starting by an IP

Hi,

I have a text file with more than 300K lines in it which I would like
to clean. Each line is of the form:

IP mm/dd/yy hh:mm

with IP being an standard IP address. This file is being populated by a
script which basically gets the IP and writes it at the end of the file.
But sometimes, this fails and I get a line with only the date and time.
My goal is to rid of these lines.

I tried something like:

:g!/^([0-9]{1,3}.)3.([0-9]{1,3})/d

but it erases the whole file. I know that this regexp is not perfect
(it will also catch 999.999.999.999, which isn't a valid IP address),
but that doesn't seem to be the problem here.

What's wrong?

Thanks for any tips.

Best,
steve


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