Friday, November 19, 2010

Re: "in word" sorting ... how ?

Christian Brabandt <cblists@256bit.org> [10-11-19 08:32]:
> On Fri, November 19, 2010 7:34 am, meino.cramer@gmx.de wrote:
> > setup l-NameOfAParameter value1
> > setup r-NameOfAParameter value2
> > intro l-NameOfAnotherParameter value3
> > intro r-NameOfAnotherParameter value4
> > physics l-NameOfASecondParameter value5
> > physics r-NameOfASecondParameter value6
> > optics l-NameOfAtPThirdecondParameter value7
> > optics r-NameOfAtPThirdecondParameter value8
> >
> > (value<n>: Floating point numbers, first row: description (one word))
> >
> >
> > unfortunately they are completly unsorted.
> >
> > How can I acchieve a sort order like that above: Important is
> > the second rows. Anything else can be ignored (in a first step).
>
> I assume you mean column?
>
> > In the second row, the "l-" and "r-" in the beginning should be
>
> s/row/column/
>
> > ignored and the rest of the parameter name should be taken for an
> > alphatical sort order. The whole lines should be moved.
> >
> > Any idea to do this with vimware alone ? Second choice would
> > be to use unix-tools.
>
> something like this:
> :%sort /^\w\+\s\+[rl]-\zs\S\+/r
>
> 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
>

Hi Christian,

wonderful! Works like a charme ! :)

(and you are right: I meant "columns" instead of rows... ;) )

...next question (may I?):

Suppose the above rows after sorting with your regexp...

Is it possible to search/highlight line-pairs (a pair with
"NameOfParameter" only differing in "l-" and "r-") which absolute
values differ (ignoring again the first column)?

For example:

setup l-NameOfAParameter 0.5
setup r-NameOfAParameter -0.5
intro l-NameOfAnotherParameter 2.71818281
intro r-NameOfAnotherParameter 3.14159259

Line 3 and 4 will be found/highlighted then.


?

Thank you very much in advance for any help ! :)
Have a nice weekend!
Best regards,
mcc


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