Re: Send-pr Diff Switches

Claus Andersen <[email protected]>
Newsgroups gmane.os.netbsd.help
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.