Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
diff cookies.old
< One cup vanilla extract
> One teaspoon vanilla extract
< Six ounces chopped liver

Any flags/options can help me get rid of this 5c5, 7d6, 21a22 in output ? What does these characters mean exactly ?

share|improve this question
up vote 1 down vote accepted

note: "Detailed Description of Normal Format"

share|improve this answer

Those are the line numbers and the operation to change one to the other. "5c5" means "line five changed (replaced) to line five", "7d6" means "delete line seven", "21a22" means "add (append) line 22"

You can change the output format using options such as --context=NUM or --unified.

Here is some more information on output formats from the info file for diff.

This command would only show the lines that are different without showing the line number and modification type (it will also eliminate the "----" dividers):

diff cookies.old | grep '^[<>]'
share|improve this answer

Sounds like you just want a more user-friendly diff output. The main reason diff is so percise is because it is used to generate patches. For more user friendly output I recommend:

[kbrandt@alpine: ~/scrap/diff] echo -e 'foo\nbar' > file1
[kbrandt@alpine: ~/scrap/diff] echo -e 'foo\nbaz' > file2
[kbrandt@alpine: ~/scrap/diff] diff -y file1 file2
foo                             foo
bar                               | baz
[kbrandt@alpine: ~/scrap/diff] colordiff -y file1 file2

Colordiff will give you the side by side output but with lines in different colors to give more emphasis to the differences.

share|improve this answer

Numbers are used to identify the offset of the file where the difference occurs.

Check diff man page or

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.