Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!uunet!bbs!ddsw1!dattier From: dattier@ddsw1.MCS.COM (David W. Tamkin) Newsgroups: comp.editors Subject: Re: vi - alphabetical sort Summary: better to use sort -d Keywords: alphabetical sort of a file Message-ID: <1990Dec14.175306.20370@ddsw1.MCS.COM> Date: 14 Dec 90 17:53:06 GMT References: <1990Dec12.214128.16549@sunee.waterloo.edu> <110900@convex.convex.com> Reply-To: dattier@ddsw1.MCS.COM (David W. Tamkin) Organization: Contributor Account at ddsw1, Wheeling, Illinois Lines: 31 tchrist@convex.COM (Tom Christiansen) wrote in <110900@convex.convex.com>: | 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? | | :%!sort | | will do it. Better by far to use sort -d. Without -d, period precedes colon, so if you subscribe to any group whose left-anchored name is included in the name of another group, your .newsrc will end up in a strange order: rec.humor.d and rec.humor.funny before rec.humor, alt.bbs.ads and alt.bbs.internet before alt.bbs, etc. | Why you would want to go into the editor just to do this, I do not know. I don't either, unless you're already editing your .newsrc to subscribe or unsubscribe various groups or to delete the article number listings for unsubscribed groups. I occasionally run my own .newsrc through %!sort -d, :g/!..*/s//!/ (to get rid of the wasted information that gets stuck there whenever an article is crossposted to both a group I read and a group I don't), and :g/!/m$ (to put unsubscribed groups at the end; :g/:/m0 would put subscribed groups at the beginning but it reverses their current order). David Tamkin Box 7002 Des Plaines IL 60018-7002 708 518 6769 312 693 0591 MCI Mail: 426-1818 GEnie: D.W.TAMKIN CIS: 73720,1570 dattier@ddsw1.mcs.com