ed
Format
The ed
output format consists of one or more hunks of
differences. The changes closest to the ends of the files come first so
that commands that change the number of lines do not affect how
ed
interprets line numbers in succeeding commands. ed
format hunks look like this:
change-command to-file-line to-file-line... .
Because ed
uses a single period on a line to indicate the end of
input, GNU diff
protects lines of changes that contain a single
period on a line by writing two periods instead, then writing a
subsequent ed
command to change the two periods into one. The
ed
format cannot represent an incomplete line, so if the second
file ends in a changed incomplete line, diff
reports an error and
then pretends that a newline was appended.
There are three types of change commands. Each consists of a line number or comma-separated range of lines in the first file and a single character indicating the kind of change to make. All line numbers are the original line numbers in the file. The types of change commands are:
Go to the first, previous, next, last section, table of contents.