Browse Source

handle exclusions more efficiently

gogsadmin 1 year ago
parent
commit
6964e73cda
1 changed files with 2 additions and 6 deletions
  1. 2 6
      update-evolution-mail-list.sh

+ 2 - 6
update-evolution-mail-list.sh

@@ -17,20 +17,16 @@ cp "$db_file" "$db_file.backup"
 #
 #  Name: Som E. Name
 #  Email: address@example.com
-mapfile -t contacts < <(find ${form_dir} -type f -name "*.txt" -exec awk -F ":" '
+mapfile -t contacts < <(grep -Fxf- -v "$excluded" < <(find ${form_dir} -type f -name "*.txt" -exec awk -F ":" '
 /Name:/ { name = $2 } /Email:/ { email = $2 } END {
   printf "%s <%s>\n", substr(name,2), substr(email,2)
 }
-' {} \;)
+' {} \;))
 
 
 # Loop through the contacts array and add each contact to the mailing list
 for contact_email in "${contacts[@]}"; do
 
-    # check exclusions
-    grep -Fx "$contact_email" >/dev/null < "$excluded" && echo "Skipped (excluded): '$contact_email'" && continue
-
-
     # Use sqlite3 to add the contact to the mailing list
     #set -x
     exists=$(sqlite3 "$db_file" <<EOF