I am trying to identify active accounts over dead accounts and was wondering if diff
along with grep
or sed
or regex
can be used, instead of writing a long program.
File1 (usernames) File2 (emails)
janedoe [email protected]
johndoe [email protected]
Each file contain about 1000 times and I need to do this frequently, once a week or so.
Task
-Check if the usernames from the File1 exist in the File2. In the above sample data, they exist.
-If they do exist, comment them out in File1.
In the past, I have used diff to compare files and have used regex to ignore lines. But unfortunately, I cannot wrap my brains around to ignore or a consider only a part of the string from the emails. (Since @ and anything after that is not comparable)
Any assistance would be appreciated. :)