Wednesday, September 15, 2010

Re: Execute commands in new window

Hi Ven!

On Mi, 15 Sep 2010, Ven Tadipatri wrote:

> Hi,
> I have a text file that I would like to sort and there's 2 things I
> would like to do. First of all I would like to eliminate all duplicate
> lines (this is on a linux machine). I tried :%s/\n\n/\n but though it
> found the duplicate lines, it replaced it with a weird @ symbol.

Yeah, that is an ancient vi'ism, I believe. Use \r in the replacing
part. (see :h NL-used-for-Nul and also :h s/\r)

> Then I would like to sort it (removing duplicates) and send the
> output to a new window. I tried the following but with no luck
> :new +!sort -u
> :new +!sort\ -u
> :new +%!sort\ -u
> :new +:%!sort\ -u

I think, you would have to double the backslashes. But I am not sure,
this does what you want. I would expect it to open a new window and in
the new empty window perform :%sort -u which is not really useful.

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

No comments: