Tuesday, June 16, 2015

Re: sorting lines by term inside a tag

On Tue, Jun 16, 2015 at 03:38:22PM -0800, Chris Lott wrote:
> I need to sort lines like this:
>
> <li><a href="http://foo.com/">Lisa</li>
> <li><a href="http://ymmv.com/">Bart</li>
> <li><a href="http://donuts.com/">Homer</li>
>
> by the name "inside" the a tag, thus:
>
> <li><a href="http://ymmv.com/">Bart</li>
> <li><a href="http://donuts.com/">Homer</li>
> <li><a href="http://foo.com/">Lisa</li>
>
> Can I do this within Vim?

Yes. The sort function accepts a regex as an argument that it will sort
by. Refer to :help sort. You can specify a pattern like /"[^"]\+"/ for
this instance.

Eric

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