Scripting question

Jerry McAllister jerrymc at msu.edu
Thu Sep 13 10:55:34 PDT 2007


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 <jerrymc at msu.edu> 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 at gmail.com NO
> > > kurt.buff at 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



More information about the freebsd-questions mailing list