Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!trantor.harris-atd.com!x102c!gbastin From: gbastin@x102c.harris-atd.com (Gary Bastin 60293) Newsgroups: comp.editors Subject: Re: vi - alphabetical sort Keywords: alphabetical sort of a file Message-ID: <5086@trantor.harris-atd.com> Date: 13 Dec 90 21:43:01 GMT References: <1990Dec12.214128.16549@sunee.waterloo.edu> Sender: news@trantor.harris-atd.com Reply-To: gbastin@x102c.ess.harris.com (Gary Bastin 60293) Organization: Harris Corporation GSS, Melbourne, Florida Lines: 30 In article <1990Dec12.214128.16549@sunee.waterloo.edu neman@sunee.waterloo.edu (Neman "Napalm" Syed) writes: >Hi! Another question from another vi-illiterate. How does one >perform an alphabetical sort of all items in a file? The >specific file I'm thinking of is my very non-alphabetical >.newsrc, which I'd love to have organized. Is this possible? vi .newsrc :1,$!sort or :%!sort will do it. If there are a few things that you would like to leave first, put those items at the top of your .newsrc file, move the cursor to the first line after the reserved "first" items, and do .,$!sort This sorts all the lines from the current cursor position to the end of the file. This way, the newly added newsgroups get put in alphabetical order AFTER your favorite newsgroups. Gary Bastin, WB4YAF /-/-/ Internet: gbastin@x102c.ess.harris.com Mail Stop 102-4826 | phone: (407) 729-3045 Harris Corporation GASD | P.O.B. 94000, Melbourne FL 32902 Speaking from, but not for, Harris!