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