home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!uknet!edcastle!mfg
- From: mfg@castle.ed.ac.uk (M Gordon)
- Newsgroups: comp.unix.shell
- Subject: Re: challenge: hex sort
- Message-ID: <24815@castle.ed.ac.uk>
- Date: 13 Aug 92 11:18:49 GMT
- References: <h1-ytad@rpi.edu>
- Organization: Edinburgh University
- Lines: 16
-
- fitzgb@mml0.meche.rpi.edu (Brian Fitzgerald) writes:
-
- >For your amusement: :-)
- >Write a shell script to sort hex in numerical order.
-
- #!/bin/sh
- awk '{printf("%200s\n",$0)}' | sort -f | sed -e 's/ *\(.\)/\1/'
-
- Change the 200 to whatever the maximum length of the numbers you want
- to sort is.
-
- --
- _ _ _ _ _
- Michael Gordon - mfg@castle.ed.ac.uk OR ee.ed.ac.uk | |_| |_| |__| |_| |
- EE Dept, Edinburgh University | . . . . . . |
- It's not an optical illusion, it just looks like one |_________|~~|_____|
-