Subject: Re: Send-pr Diff Switches
To: None <netbsd-help@netbsd.org>
From: Claus Andersen <clan@wheel.dk>
List: netbsd-help
Date: 05/18/2007 10:20:09
On Thu, 17 May 2007, Randy Beaudreault wrote:

>> On May 17, 2007, at 3:56 PM, Randy Beaudreault wrote:
>>> What switches do I use with diff to generate a file suitable to upload for 
>>> a bug report?
>> 
>> Most people prefer unified diffs; "diff -dur" is commonly used.
>
> Unified diffs are and are generated how?

Unified diffs are simply the common format used nowadays (as opposed to 
the older "context" format).

You simply generate a diff by issuing "diff -dur file1 file2" at the 
command line.

The following simple example demonstrates it:

Create a text file:

$ echo Hello world! > myfile1.txt
$ echo This is a line of text >> myfile1.txt

Copy the file:

$ cp myfile1.txt myfile2.txt

Add another line of text to the new file:

$ echo This is another line of text >> myfile2.txt

You can now create a unified diff of the two files like this:

$ diff -dur myfile1.txt myfile2.txt

If you want to output it to a file then do:

$ diff -dur myfile1.txt myfile2.txt > myfile.diff

...more reading can be found with "man diff"

-- 
Claus