• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

comm or diff command

VeeDubbs

Limp Gawd
Joined
Dec 9, 2005
Messages
398
I have two files that contain account names. I need to compare them and get a print out of what is in file2 that is not in file1. So, if jjones is in both, I don't care. If jsmith is in file1 and not file2, again, I don't care. However, if jjohnson is in file2 but not in file1 I want to know about it.

I've been playing around with these commands and I can't seem to get it to give me the correct information.

If i do comm -1 -3 file1 file2 it seems to just print out everything that is in file2.

Am I dont something wrong?

Please help...
 
comm wants the input files to be sorted.

$ sort file1 > file1.tmp
$ sort file2 > file2.tmp
$ comm -1 -3 file1.tmp file2.tmp

-Corey
 
Thanks for the reply. But that just gives me what is in file2 still.

Me confused....

EDIT - okay, I just made two test files with very little in them, but a few differences. I did the comm -1 -3 file1 file2 > file3 -- and file3 was exactly as it should be.

Could I be having an issue with how the files are formatted before the comm command is used?
 
You did compare the sorted files, right? The commands I gave you work fine for some small test files. Can you provide a sample line from one of the files (or a fake line that looks the same)?
 
Back
Top