#!/bin/bash ## constructs a List-Difference, those on first list but not on 2nd list, for lists of email-addresses; by Eugene Reimer 2007-Nov01; ## eg: to send to ELIST-Regina - but only to those NOT receiving the Elist-emailings. ## ## Input Lines can be: ## NameComment <--uniquify-emailidlist script caters to this format, even to combining NameComments... ## NameComment (TAB)##comment ## email-id(TAB)##comment <--harvest-emailids script produces this format (comment shows the source webpage) ## The Output will be without (TAB)##comment, as wanted by sendtoElist script. ## ## USAGE EXAMPLE: ## ListSubtract-e ELIST-Regina Elist-20071027 >ELIST-Regina-lessElist [ $# -ne 2 ] && { echo "usage: ListSubtract-e ELIST-XX Elist-YY >ELIST-XX-less-YY"; exit; } while read; do ##read line by line... TRIM=${REPLY%% *} ##remove TAB+comment if present ID=${TRIM#*<}; ID=${ID%>*} ##remove NameComment if present if ! grep -q $ID $2;then echo "$TRIM" >&1 ##output line to stdout, using $ID for matching, but producing $TRIM ##else echo "--removing $REPLY" >&2 ##removing msg to stderr (DEBUG only) fi done <$1 ##reads from first param exit Notes for myself: ELIST-Regina has: NameComment ELIST-OrchidMall has: email-id(TAB)##comment