home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / unix / misc / 4995 < prev    next >
Encoding:
Text File  |  1993-01-21  |  2.4 KB  |  77 lines

  1. Newsgroups: comp.unix.misc
  2. Path: sparky!uunet!noc.near.net!bolling.proteon.com!gpr
  3. From: gpr@proteon.com (Gary Richardson)
  4. Subject: Trying to "sort" a hosttable
  5. Message-ID: <C1823z.7r7@proteon.com>
  6. Keywords: Ain't as easy as I thought...
  7. Organization: Proteon Inc.
  8. Date: Thu, 21 Jan 1993 20:55:07 GMT
  9. Lines: 66
  10.  
  11.  
  12. Hi all,
  13.  
  14. Our /etc/hosts table on our DNS host is in alphabetical order
  15. by hostname. I want to put it in ip address numerical order.
  16. I've read the man page on sort back and forth, but still can't
  17. get the damn thing right. When i run the command:
  18.  
  19.         sort -t. +2n -3.3n hosts
  20.  
  21.  
  22. I get output like this:
  23.  
  24. 127.0.0.1       localhost loghost
  25. 128.185.1.2     chaplin.proteon.com chaplin
  26. 128.185.1.22    c-room.proteon.com c-room
  27. 128.185.1.3     wcfields.proteon.com wcfields
  28. 128.185.1.6     laurel.proteon.com laurel
  29. 128.185.2.22    c-room.proteon.com c-room
  30. 128.185.2.31    relay1.proteon.com relay1
  31. 128.185.2.48    relay.proteon.com relay
  32. 128.185.2.7     frelay.proteon.com frelay
  33. 128.185.3.1     frelay.proteon.com frelay
  34. 128.185.3.2     federal.proteon.com federal
  35. 128.185.3.5     atlanta.proteon.com atlanta
  36. 128.185.3.6     houston.proteon.com houston
  37. 128.185.4.1     frelay.proteon.com frelay
  38. 128.185.4.2     nottingham.proteon.com nottingham
  39. 128.185.5.18    slime-sync.proteon.com slime-sync
  40. 128.185.11.100  dhb.pc.proteon.com dhb
  41. 128.185.11.101  mmg.pc.proteon.com mmg
  42. 128.185.11.103  gpr.pc.proteon.com gpr
  43. 128.185.11.108  hs.pc.proteon.com hs
  44. 128.185.11.109  doc.pc.proteon.com doc
  45. 128.185.11.110  pc.pc.proteon.com pc
  46. 128.185.11.111  syb.pc.proteon.com syb
  47. 128.185.11.144  nks.pc.proteon.com nks
  48. 128.185.11.166  mah.pc.proteon.com mah
  49. 128.185.11.2    chaplin.proteon.com chaplin
  50. 128.185.11.202  tje.pc.proteon.com tje
  51. 128.185.11.48   fmf.pc.proteon.com fmf
  52. 128.185.11.5    janis.proteon.com janis
  53. 128.185.11.50   xxx.pc.proteon.com xxx
  54. ...
  55.  
  56. The subnet (third section) sorts fine, but the hostnumber is sorting
  57. like they're characters and not numbers, even though I'm using the
  58. "n".
  59.  
  60. Does anyone know the command I need to use to get my host table
  61. in a true and complete numerical order?
  62.  
  63.  
  64. Please respond via email... I don't get the chance to read news
  65. all that often.
  66.  
  67. Thanks!! I'll summarize!
  68.  
  69. -Gary
  70.  
  71.  
  72. -- 
  73.     ____  ___  ____  ____  ____  ____            WHO: Gary Richardson
  74.    /___/ /__/ /   /   /   /__   /   /  /| /       HOW: gpr@proteon.com
  75.   /     /  | /___/   /   /____ /___/  / |/ INC.  WHAT: Unix Systems Admin
  76. ___________ 9 Technology Dr, Westboro, Ma 01581__________________________ 
  77.