Wednesday, October 12, 2016

Re: Sorting a column without altering other columns

On 2016-10-10, Cesar Romani wrote:
> I'm trying to sort the third column without altering ther first two
> columns, but to no avail:
>
> 1. LARGEST 40
> 2. SECOND-LARGEST 168
> 3. MID 2.8
> 4. MID 540
> 5. MID 14.84
> 6. MID 40
> 7. SECOND-LEAST 64
> 8. LEAST 8
>
> I've tried to use the B command of the vis.vim plugin, as in:
> '<,'>B sort n
>
> but it doesn't work.

It worked fine for me.

I put the cursor on the '4' in the first line, then typed

Ctrl-V
$
7j
:B sort!n

Voila!

1. LARGEST 540
2. SECOND-LARGEST 168
3. MID 64
4. MID 40
5. MID 40
6. MID 14.84
7. SECOND-LEAST 8
8. LEAST 2.8

Regards,
Gary

--
--
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/d/optout.

No comments: