Reconcile one list against anotherby spartan (Pilgrim)
|on May 04, 2011 at 17:59 UTC||Need Help??|
spartan has asked for the wisdom of the Perl Monks concerning the following question:
Greetings, it has been quite a while since I posted a question, but I've been lurking always reading the wisdom contained herein.
My question is this: I have 2 text files. Each one looks like something one would see when they cat /etc/passwd. The first file (I'll call it file1) has a list of users that need accounts. The second file has a list (in /etc/passwd format) of current accounts.
I easily created a list of users that *need* accounts by simple shell looping and grep. I was also able to produce a list of duplicate users easily enough via the shell again.
Alas, the last thing i wanted to do was to show who was left. These would be the accounts that have to be deleted. When simple shell one liners were of no avail, I turned to my swiss army knife of text processing, but I must admit that I am thwarted by this seemingly simple task.
Could I have just edited the files side by side? I could have, but I thought I was cheating myself out of an opportunity to learn something. And I here I am. I have code that I will paste below with copious comments as to what I think I should do, but what ultimately escapes me.
In my defense I will say one thing. I am not a programmer by trade, nor have I taken any programming courses outside of basic programming, and Pascal in high school.
Very funny Scotty... Now PLEASE beam down my PANTS!