On Wed, Sep 15, 2010 at 2:21 PM, Christian Brabandt <[email protected]> wrote: > 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) >
Yeah the \r in the replace part worked. That's really weird, because though it does the right behavior, after the replace, if I search for \r it says it can't find it, so somehow it translates \r in the replace clause to \n in the buffer. >> 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 Anyone else have ideas on how to get this behavior to work. It seems like something vi should be capable of doing - I want to execute a command on the current buffer and launch it in a new one. > > 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. The double backslashes didn't seem to work. This behavior is useful because I want to compare the output before and after the sort, in 2 separate buffers, so I don't want it to be in the same window. Thanks, Ven > > 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
