From owner-freebsd-questions@FreeBSD.ORG Thu Sep 13 17:55:34 2007 Return-Path: Delivered-To: questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBC1416A419 for ; Thu, 13 Sep 2007 17:55:34 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (gizmo.acns.msu.edu [35.8.1.43]) by mx1.freebsd.org (Postfix) with ESMTP id 7A9C213C457 for ; Thu, 13 Sep 2007 17:55:34 +0000 (UTC) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: from gizmo.acns.msu.edu (localhost [127.0.0.1]) by gizmo.acns.msu.edu (8.13.6/8.13.6) with ESMTP id l8DHtAPI079031; Thu, 13 Sep 2007 13:55:10 -0400 (EDT) (envelope-from jerrymc@gizmo.acns.msu.edu) Received: (from jerrymc@localhost) by gizmo.acns.msu.edu (8.13.6/8.13.6/Submit) id l8DHtAP5079030; Thu, 13 Sep 2007 13:55:10 -0400 (EDT) (envelope-from jerrymc) Date: Thu, 13 Sep 2007 13:55:10 -0400 From: Jerry McAllister To: Kurt Buff Message-ID: <20070913175510.GA78984@gizmo.acns.msu.edu> References: <20070913172001.GA78799@gizmo.acns.msu.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.2i Cc: questions@freebsd.org Subject: Re: Scripting question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Sep 2007 17:55:34 -0000 First, please always make sure your responses go to the list. It is both list etiquette and of practical value. Follow-ups to only an individual may not reach the person who can provide real help. Most Email clients have a group reply which will do the trick. On Thu, Sep 13, 2007 at 10:32:34AM -0700, Kurt Buff wrote: > On 9/13/07, Jerry McAllister wrote: > > On Thu, Sep 13, 2007 at 10:16:40AM -0700, Kurt Buff wrote: > > > > > I'm trying to do some text file manipulation, and it's driving me nuts. > > > > > > I've got a sorted file of SMTP addresses, and want to eliminate the > > > lines that are the same up to a space character within the line. > > > > > > Example: > > > > > > kurt.buff@gmail.com NO > > > kurt.buff@gmail.com OK > > > > > > The above lines *both* need to be eliminated from output - I don't > > > want the first or second of them, I want them both gone. > > > > > > I've looked at sort and uniq, and I've googled a fair bit but can't > > > seem to find anything that would do this. > > > > Seems like this is right up sort's alley. > > Is the first string always separated from the rest by white space > > or does your first string sometimes include white space. > > > > ////jerry > > The only space is the one separating the SMTP address from the OK or NO. Then you should be able to tell it to sort on the first token in the string with white space as a separator and to eliminate duplicates. It has been a long time since I had need of sort. I don't remember the arguments/flags but am sure that type of thing can be done. ////jerry