home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / unix / shell / 3476 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  898 b 

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