OK I will try to give some good examples here. With the occasional extra crap bolded.
file151:
bob:johnson:3343:bjohn@email_SB.org,bjohn@emailARG.org,3343@email.org
sol:admin:3344:sadmin@email_SB.org,sadmin@emailARG.org,3344@email.org
joe:sample:
JR:3345:jsample@email_SB.org,jsample@emailARG.org,3345@email.org
john:
De:Salva:3346:jds@email.com,jDesalva@emailRAG.edu,jSalva@email.com
Now for file152 what you have there is correct but sometimes you get an extra name field so I will add a few for example:
bob:johnson:bjohn@email_SB.org
sol:admin:3344@email.org
joe:sample:jsample@email_SB.org
bill:jones:
jr:bjones@email.edu
bill:
jones:john:jr:sampson:bjs@emailARG.edu
Things that are safe to assume:
file152:
This will have an email (and only one email) in each line.
This is the email I will need to trim out and use to get the corresponding line out of file151 to work with...
file151:
This will have at least one line with an email in it that will match the email from the file152.
Each line in this file will have a unique 4 digit number that is the Id number somewhere in it. (I need to get that out and into a variable)
Also somewhere in each line of this file there will be an email ending in "something@ARG.edu" (I need to get that out too)
SO once I get the ID and the
something@ARG.edu email out of each line in file 151 I will write the line back out to a new file like this:
IDfrom151:entire line from file 152:something@ARG.edu email from 151
follow me? Or do I need to give more examples lines?
Where the other script fails is in the cut commands, they assume field 3 is email when in fact field 4 could be email, if there is a Jr. in the mix. Or field 5 if there is a Jr. and 2 middle names...