Thursday, September 1, 2011

Re: Search and write

Still gets the whole content to the my.txt file. How to not write the whole buffer?

Lars Iselid




On Thu, Sep 1, 2011 at 12:24 PM, Christian Brabandt <cblists@256bit.org> wrote:
Hi Lars!

On Do, 01 Sep 2011, Lars Iselid wrote:

> Ok, I've changed to:
> :g/[-0-9]\{13,17\}/t.|s/^[0-9]\+//g|w! >> my.txt | d
>
> I still not just get the 13 to 17 digits strings. You say it will copy all
> the lines that starts with digits. I don't want the whole line just the
> digit string, not what follows with exception if it's another 13 to 17
> digits string.

I think it was correct to have the negation in the s/ command, because
you want to delete (replace) all characters, but digits. Anyway, :w will
always write the whole buffer, if not given a range, so try changing the
command to

:g/[-0-9]\{13,17\}/t.|s/[^0-9]\+//g|.w! >> my.txt | d

regards,
Christian

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

No comments: