I have two files, both are outputs from a code that I have put through cut to only look at the first 26 characters of each line. Both files are lists of parameters that the code measured, such as "total cross section," or "neutron lifetime," as well as the options that code used like "MPI_TASKS," or "COMPILE_DATE" so file1 looks like:


File2 looks basically the same, but many of the parameters are deleted or changed, and some different ones are added.

Instead of reporting where those changes/additions/deletions occur, diff tells me that lines 12 through 1750 of file1 were deleted, and then finds about 300 lines of differences for the rest of the files. Even in those differences, it only reports a change in maybe 50 of those, the rest are reported as additions/deletions.

I am really just utterly confused and have no idea why diff is acting this way. I've tried using some options like -aBCHw.

Is there a better utility I can use with this? Is the cut utility causing problems?

  • Did you try with --minimal? Also provide a true example with sample of files that provokes the problem, if you want others to try and give you the most relevant answers. Jul 24, 2018 at 23:24
  • Sorry, what exactly would be a 'true example'? Thanks
    – Lou
    Jul 25, 2018 at 14:47
  • Give two files and the diff results you see between them that you do no want to have. That way, other people could try and see things by themselves and provides you solutions. It is basically the idea spelled out at stackoverflow.com/help/mcve Jul 25, 2018 at 15:04

1 Answer 1


By default, diff assumes some context around each part of the difference, called a chunk. If you reduce the context (using the optional value for the -C option), you reduce the chunk-size and make it less likely to report large (overlapping) chunks as a big difference.

  • Thanks! I'm a little confused reading the output with -C, it's a lot different from what I'm used to. Could you point me towards a resource that will explain it explicitly?
    – Lou
    Jul 25, 2018 at 14:48
  • hmm- context diff imitates change-bars (in a printed document, a vertical mark on the margin showing areas that are changed). The documentation for diff is terse, because all of that was done long ago -- I have a page discussing unified diff along with related topics. Jul 25, 2018 at 15:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .