Solved: Re: Diff two address lists?



On 07/28/2012 10:11 AM, Jonesy wrote:
On Fri, 27 Jul 2012 20:08:22 -0700, Patton wrote:
I have a need to compare two lists of email addresses. Each one is a
text file with address per line. What I need to output is a list of
email addresses that are only in list B, I do not want the addresses
that are in both or are only in A.
_IF_ (big "if") the two lists are pure email addys with no further
embellishments/contents, something viz:

grep -v -f "B"_file "A"_file

Or, maybe I'm rong. Haven't had my coffee yet....

Jonesy

Thanks, but since the lists had columns for "first name" "Last name" and "Full Name", I think that would not work. I ended up doing a script that did something similar

For those searching the archives with the same problem,

#! /bin/bash
# Crosswalk file1 against file2
# output lines of file2 not in file1 to file3
# Use Syntax parse-csv.sh file1 file2 file3

FILE_1="$1"
FILE_2="$2"
FILE_3="$3"

cp $FILE_2 TX_FILE_1.csv

# for each line, parse the fields into script variables
while IFS='\",\"' read a b c d
do

# Now grep the TX file and print everything but the line with the email in the line of the first input file ($d )

grep -v $d TX_FILE_1.csv > TX_FILE_2.csv
mv TX_FILE_2.csv TX_FILE_1.csv

# Next for debugging, to see what the script thinks the variable is
echo "Dee is equal $d"

done < $FILE_1 #end the loop

cp TX_FILE_1.csv $FILE_3

=====================

There might have been a more elegant way, but this worked. Anyone wants to comment, I appreciate learning new stuff.

--
Patton


--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: Batch Display of Service Pack Version
    ... When you put commands in a batch file, you have to double the percent ... signs that identify script variables such as %A and %0, ... Here's the modified script. ... > script and paste it into a command window, ...
    (microsoft.public.windows.file_system)
  • Re: Script question
    ... Switch to the desired layout ... Are you using a version of FileMaker capable of script variables? ... use the script variable as theSearchValue in the third ...
    (comp.databases.filemaker)
  • FM 8 Design Report - Missing Field?
    ... I have just created a Design Report for a complex database, ... Missing Fileds. ... I think that disabled script steps may be part of this problem, ... I don't seem to be able to find script variables ...
    (comp.databases.filemaker)
  • Re: Button to create record in related table
    ... There were no script variables, but I believe there were script parameters. ... You can do that either by creating the record in the portal, or by use of a script with a global field to store the key field value and then set the key field value in the related support table. ...
    (comp.databases.filemaker)
  • Re: Parsing strings via shell vars?
    ... My shell scripting must be getting rusty and a quick google isn't ... > I need to find a way to parse a shell variable rather than a file, ... > it's basically using a few system files to determine what variant of *nix ... > further filesystem checks to verify what specific flavor of *nix the script ...
    (comp.unix.shell)