From owner-freebsd-questions@FreeBSD.ORG Thu Sep 13 18:31:32 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 4572616A420 for ; Thu, 13 Sep 2007 18:31:32 +0000 (UTC) (envelope-from kurt.buff@gmail.com) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.238]) by mx1.freebsd.org (Postfix) with ESMTP id D4FCB13C45A for ; Thu, 13 Sep 2007 18:31:31 +0000 (UTC) (envelope-from kurt.buff@gmail.com) Received: by wr-out-0506.google.com with SMTP id 70so305005wra for ; Thu, 13 Sep 2007 11:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=zsOhGqGM6t7AI5B4AXYsCTKOQoFnWyWpMQQohMcM2/I=; b=Fel/JqurARAYtd29nhi6l9UgkJKy0fOlgdhOtXiqbflKeQEHd/EERgurnKbxSq0fnl680ywWWmbC77CpoKDCA5pZFM6L/QZC3LZiYs1+LdCOVTX8cYFw9vpD5/5BRTCeAkx9Ec69UkgHx4+BrUZDo7+CGjxv0meoWDL61sTwBJI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Gs6zEIbc5dgZgF1ry+yvERm0GQS067Ce4Tco/3CSqNeP6EQbGVwQeL1VvbGTq4nm8ae2Bro8dCYW9E+SX4nlcMoIy9xRItCMucr0FaLQAxpR+wVaCjuEW/5HZMrRgKLAZepJZYUdrsUxCicA5+mJJj+WqS51WR5U8eqHzYWZqKs= Received: by 10.142.102.5 with SMTP id z5mr184258wfb.1189706772040; Thu, 13 Sep 2007 11:06:12 -0700 (PDT) Received: by 10.142.78.21 with HTTP; Thu, 13 Sep 2007 11:06:12 -0700 (PDT) Message-ID: Date: Thu, 13 Sep 2007 11:06:12 -0700 From: "Kurt Buff" To: "Jerry McAllister" In-Reply-To: <20070913175510.GA78984@gizmo.acns.msu.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070913172001.GA78799@gizmo.acns.msu.edu> <20070913175510.GA78984@gizmo.acns.msu.edu> 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 18:31:32 -0000 On 9/13/07, Jerry McAllister wrote: > > 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. Yup - that's my fault, and contrary to my intent - I was using the web interface, and it's too easy to just hit the reply button instead of "reply to all" - mea culpa. > 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. Tried that, and it doesn't work the way I expect, or else I'm doing it wrong, which is definitely possible. My first difficulty is that I can't figure out how to specify the space as the field delimiter, assuming that -t is the correct parameter for that. I've tried specifying '@' for -t, but that doesn't work either. Next, my suspicion is that the -u parameter will simply output the first line of a set of non-unique lines, which is what it does normally - it doesn't seem to eliminate all non-unique lines, it just makes the first line the unique one. Am I making sense? Kurt