procmail
[Top] [All Lists]

Re: Utility to maintain user addresses

1995-12-14 09:29:42

John said:

On Wed, 13 Dec 1995, Eric Hilding wrote:

You can purge out duplicates with a perl script, etc.

So.....do you or anyone else on the list have a script (perl, tcl, sh)
that will do this?  Yes, easy enough to write, but if it's already
written.....

sh:

#!/bin/sh

sort $1 | uniq > tempfile
mv tempfile $1

Add the appropriate locking

perl:

perl -nie 'if (!(defined $list{$_})) {print ; $list{$_}="foo";}'

would seem to do it.  (mod the syntax.  My perl is really rusty).

I do not know about tcl.  I suppose that you could do the analogous
thing without resorting to non-builtins in sh.  But that would take more
than two lines.

Soren

<Prev in Thread] Current Thread [Next in Thread>