Tuesday, June 16, 2015

Re: sorting lines by term inside a tag

On 2015-06-16, 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?

The {pattern} argument tells the :sort command to ignore the text
matching the pattern. See

:help :sort

In your example, you want to skip everything through the '">', so
this would work:

:sort /.*">/

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: