diff

QNX SDP8.0Utilities ReferenceUtilities

Compare two files, line by line (POSIX, toybox)

Syntax:

diff [-abBdiNqrTstw]] [-L label] [-S file] [-U lines] [-F regex] file1 file2

Runs on:

QNX OS

Options:

-a
Treat all files as text.
-B
Ignore changes where the lines are all blank.
-b
Ignore changes in the amount of whitespace.
-d
Try hard to find a smaller set of changes.
-F regex
Show the most recent line matching the regular expression.
-i
Ignore case differences.
-L label
Use label instead of the filename in the unified header.
-N
Treat absent files as empty.
-q
Output only whether files differ.
-r
Recursively compare two files.
-S file
Start with file when comparing directories.
-s
Report when two files are the same.
-T
Make tabs line up by prefixing a tab when necessary.
-t
Expand tabs to spaces in the output.
-U lines
Output the number of lines of context specified by lines.
-u
Unified diff.
-w
Ignore all whitespace.
--color
Color output.
--strip-trailing-cr
Strip trailing carriage return (e.g., \r) from input lines.
--type-line-format=format
Display the specified type of line using the specified format, where type unchanged, old, or new. (format unchanged, old, and new as literals)
%L
The contents of the line, including the trailing newline.
%l
("el") The contents of the line, without the trailing newline.
%%
A literal %.
file1
The pathname of the first file to be compared.
file2
The pathname of the second file to be compared.

Description:

The diff utility reports the differences between two files.

The format variable uses printf integer escapes (e.g., %-2.4x) followed by one of the letters:

  • E — F-1
  • F — the first line number
  • L — the last line number
  • M — L+1
  • N — the number of lines = L-F+1

This utility is provided as part of the toybox package. For information on how to enable it, see toybox.

Contributing author:

Rob Landley and the toybox project (see https://landley.net/toybox/).

Page updated: