Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ukma!gatech!ncar!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: sort question Message-ID: <17411@mimsy.UUCP> Date: 10 May 89 09:02:21 GMT References: <199448@hrc.UUCP> <810050@hpsemc.HP.COM> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 51 In article <810050@hpsemc.HP.COM> gph@hpsemc.HP.COM (Paul Houtz) writes: >Right. There is no way to do a true column sort using this utility as you >can on IBM or MPE systems and here is why: Sort requires a FIELD DELIMITER >character. That means that there is SOME character that will never be >sorted. But (as you yourself point out) you can set the field delimiter to newline, effectively making it vanish, then use the 0.n format to specify column n. >Here is the worst one I have seen on Unix. I converted this myself from a >sort done on an IBM System/34. This is a good example of a COMMON type of >sort done in the commercial world which you never see on Unix: > >sort -dt'\012' +0.6 -0.8 +0.13 -0.15 +0.15r -0.17r +0.8 -0.13 ... > >This guy sorts the summary file using the newline character as a field >delimiter (i.e., no fields), and you can tell what column ranges are >being sorted by subtracting 1 from the 'x' field of the 0.x parms. Or simply think of columns as numbered from 0 (if you count from 0 to 1023 on your fingers, as I do :-) ). >If anyone ever tries to tell you that UNIX is user friendly, you can now >barf on them. Why? (Actually, Unix is not *meant* to be `user friendly'---if that means `taking occasional users by the hand and leading them from each little stepping stone on to the next'. It is meant to get the job done simply, tersely, without back-talk. If you use a system every day, you can get tired of wading through six levels of menus. And if Unix looks a little old and creaky in the user-interface area, well, it *was* designed around printing terminals and dumb CRTs. But then again, that is all I have at home. [An H19 with the Heath ROMs can hardly be called clever :-) .]) If this sort of thing is not done often in Unix, why not? Perhaps because it is a bad idea not to delimit fields. (I believe that any fixed limit---this includes fixed field widths---is always too small. I sometimes wonder what IBMers do about people with last names like `de Martinesquez y de la Capillostraglio'; I *know* what they do with people who, like me, put down an initial for a first name and a name for a middle initial.) But if, like Houtz, you are forced to make the best of a bad design, and you dislike all the `+0.x -0.y', instead of sulking, you *could* write a small shell script to convert whatever column format you prefer into what sort requires. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris