Friday, January 28, 2011

Re: Indpendant position marks for scripts ?

Ben Schmidt <mail_ben_schmidt@yahoo.com.au> [11-01-29 06:24]:
> On 29/01/11 3:42 PM, meino.cramer@gmx.de wrote:
> >
> >Hi,
> >
> >I want to process a text with script.
> >The text contains of two regions:
> >The first region contains of lines beginning with keyword_a
> >and the second one start with keyword_b.
> >I want to sort the first region using sort with pattern_a and
> >after that I want to sort the second region with pattern_b.
> >
> >I can set the start of the forst sort with
> >
> > : /keyword_a
> >
> >in the script. But I dont know how to limit the range of the first
> >sort so that only lines starting with keyword_a are sorted using
> >pattern_a. Same goes for the second region...
>
> Try something like
>
> :0/^a/,/^\(a\)\@!/sort
>
> It means loosely:
>
> : - perform an ex command
> 0 - from before the beginning of the file
> /^keyword_a/ - find a line beginning with 'keyword_a'
> , - and operate until
> / - we find
> ^ - the beginning of a line
> \(keyword_a\)\@! - where 'keyword_a' doesn't match
> /sort - with the sort command
>
> Ben.
>
>
>
> --
> 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 Ben,

GREAT! Thanks a lot! That helps me much!

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:

Post a Comment