Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!usc!ucsd!ucbvax!agate!usenet From: c60b-3ac@e260-3d.berkeley.edu (Eric Thompson) Newsgroups: comp.unix.questions Subject: Re: Need help ** removing duplicate rows ** (solution & thanks) Message-ID: <1990Nov2.184421.22754@agate.berkeley.edu> Date: 2 Nov 90 18:44:21 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: University of California, Berkeley Lines: 18 A hearty THANK YOU to everyone who responded. Just thought I'd let you know that this is the solution I ended up using: > From: tslwat!louk (Lou Kates) > Subject: unique lines except for field 2 > > The following command will do it (on some systems you must say nawk > instead of awk) where x.dat is the data above: > > awk -F: ' { tmp = $0; $2 = ""; store[$0]=tmp; freq[$0]++} > END { for(i in store) if (freq[i]==1) print store[i]}' x.dat The answers using 'sort' were almost what I needed--but I didn't want to save ANY occurences of lines that had duplicate information (probably my fault for not being clear enough). Again, thanks. I appreciate it. Eric Thompson | et@ocf.Berkeley.EDU STONE ROSES & A'S BASEBALL | ...!ucbvax!ocf!et