[Linux-disciples] Re: Sorting lines matching a pattern

Stephen R Laniel steve at laniels.org
Sun Jul 24 22:48:28 EDT 2005


On Sun, Jul 24, 2005 at 10:12:34PM -0400, Stephen R Laniel wrote:
> :g/^\*/!sort

Well, because of the structure of my document, I *could* do

1G	[go to first line]
/^\*	[go to first line that begins with '*']
vG	[select everything up to the last line]
$	[on that last line, make sure to select all the way to the
  end]
:!sort	[sort]

That takes advantage of the particular structure of the
thing, where the last line in the document happens to also
be a '^\*' line. I'd really prefer to select all the '^\*'
lines and sort them together, but this will do for now.

-- 
Stephen R. Laniel
steve at laniels.org
+(617) 308-5571
http://laniels.org/
PGP key: http://laniels.org/slaniel.key
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.bostoncoop.net/pipermail/linux-disciples/attachments/20050724/2fb0731b/attachment.pgp


More information about the Linux-disciples mailing list