"diff" command

Joined
Apr 19, 2010
Messages
2
Reaction score
0
Points
1
Is there anyway to run diff on terminal to find identical data. For example let's say I have two files of e-mails. My boss wants me to find which e-mails overlap in both files. How do i run this diff in terminal?
 

bobtomay

,
Retired Staff
Joined
Dec 22, 2006
Messages
26,561
Reaction score
677
Points
113
Location
Texas, where else?
Your Mac's Specs
15" MBP '06 2.33 C2D 4GB 10.7; 13" MBA '14 1.8 i7 8GB 10.11; 21" iMac '13 2.9 i5 8GB 10.11; 6S
Moved post to it's own thread. Please don't post new questions on unrelated 3 yr old threads. People tend to notice that when they open it up and pass on responding. Thanks

Sorry, can't help... I'm one of thise GUI types.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
Have to assume you are running some kind of script. Check $status immediately upon return. Also, I think you'll want to use '-q' to limit differences that are spit out, and send any output to /dev/null.
 
Joined
May 27, 2010
Messages
21
Reaction score
0
Points
1
That's easy if I understand your question. In a Terminal window, type "diff" and then the names of the files you want the computer to compare. For example, if you want to compare the contents of two text files you can write something like this: "diff telegram.txt letter.txt". If the files differ, the computer will tell you about the first difference it finds. If the files are the same, it won't say anything about them. To compare files side by side, use sdiff instead of diff.

Naturally, you probably won't use the quotation marks when you type the command. But you will need quotation marks if your file names contain spaces.

Is there anyway to run diff on terminal to find identical data. For example let's say I have two files of e-mails. My boss wants me to find which e-mails overlap in both files. How do i run this diff in terminal?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top