home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / amiga / programm / 18533 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.8 KB

  1. Path: sparky!uunet!caen!nic.umass.edu!dime!barrett
  2. From: barrett@astro.cs.umass.edu (Daniel Barrett)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Need a program to compare lines in a text file
  5. Message-ID: <58575@dime.cs.umass.edu>
  6. Date: 12 Jan 93 02:38:43 GMT
  7. References: <C0pro2.K44@news.cso.uiuc.edu> <1993Jan12.002441.19621@hpcvca.cv.hp.com>
  8. Sender: news@dime.cs.umass.edu
  9. Reply-To: barrett@astro.cs.umass.edu (Daniel Barrett)
  10. Organization: BLAZEMONGER INCORPORATED
  11. Lines: 32
  12.  
  13. >miller@mrcnext.cso.uiuc.edu (Geoffrey M. Miller) writes:
  14. >: 1. Read in a line of text.
  15. >: 2. Compare that line to every line thereafter, deleting all identical lines.
  16. >: 3. Read in the next line and proceed, etc.
  17.  
  18. In article <1993Jan12.002441.19621@hpcvca.cv.hp.com> abrown@hpcvcec.cv.hp.com (Allen Brown) writes:
  19. >You have just described the 'uniq' program of Unix vintage.
  20.  
  21.     No, he hasn't:  you've made a common mistake.  "uniq" does not
  22. eliminate all duplicates -- just ADJACENT duplicate lines.  If you want
  23. all duplicates removed, you must sort the file first.
  24.  
  25.         sort filename | uniq > outfile
  26.  
  27. (Note that the above is a UNIX command.)  Alternatively, you can use the
  28. UNIX sort command's "-u" option:
  29.  
  30.         sort -u filename > outfile
  31.  
  32. >I am five miles from my Amiga so I cannot get specific.  But there are
  33. >numerous Unix like packages in the Fish lists.
  34.  
  35.     There is a complete port of the GNU TextUtils available by
  36. ftp from amiga.physik.unizh.ch and its mirror sites, containing both
  37. uniq and sort (among others).
  38.  
  39.                                                         Dan
  40.  
  41.  //////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
  42. | Dan Barrett -- Dept of Computer Science, Lederle Graduate Research Center |
  43. | University of Massachusetts, Amherst, MA  01003  --  barrett@cs.umass.edu |
  44.  \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////
  45.