You are not logged in.
Okay, so I have been trying to use diff to do this, but I am failing, as this isn't code I am looking at (and I'm not really a programmer).
I have two text files with a single line per entry (which is a userid). I need to be able to compare the two files, and output only the userid's that don't show up in one of the files.
Example:
File 1 File 2
a a
b s
c c
d t
So the output would be simply s and t.
Can I use diff to do this? If not, can someone maybe hack up a quick Perl script or something? I know there has to be a better way than going through a 2000+ userid file by hand.
Thanks!
Last edited by lifeafter2am (2010-08-27 16:19:53)
#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.
Offline
diff will only tell you the differences between files. What you want is something custom. So you might just have to create a script to do it.
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
I'm not sure but perhaps what might work for you is the command "comm". See "man comm" for more details.
Edit: good ol' falconindy beat me to it!
Last edited by lagagnon (2010-08-27 15:09:51)
Philosophy is looking for a black cat in a dark room. Metaphysics is looking for a black cat in a dark room that isn't there. Religion is looking for a black cat in a dark room that isn't there and shouting "I found it!". Science is looking for a black cat in a dark room with a flashlight.
Offline
cat file1 file1 file2 | sort | uniq -u
Offline
You guys rock! Comm did what I needed it to do after I sorted the files.
Thanks!!
#binarii @ irc.binarii.net
Matrix Server: https://matrix.binarii.net
-------------
Allan -> ArchBang is not supported because it is stupid.
Offline
grep -v -f file1 file2
Offline
If you prefer a gui solution, i can recommend you diffuse: diffuse in aur
Last edited by jvalecillos (2010-08-29 17:06:18)
Offline