Next: , Previous: Tabs, Up: Adjusting Output

5.2 Omitting trailing blanks

When outputting lines in normal or context format, or outputting an unchanged line in unified format, diff normally outputs a blank just before each line. If the line is empty, the output of diff therefore contains trailing blanks even though the input does not contain them. For example, when outputting an unchanged empty line in context format, diff normally outputs a line with two leading spaces.

Some text editors and email agents routinely delete trailing blanks, so it can be a problem to deal with diff output files that contain them. You can avoid this problem with the --suppress-blank-empty option. It causes diff to omit trailing blanks at the end of output lines in normal, context, and unified format, unless the trailing blanks were already present in the input. This changes the output format slightly, so that output lines are guaranteed to never end in a blank unless an input line ends in a blank. This format is less likely to be munged by text editors or by transmission via email. It is accepted by GNU patch as well.