|Comparing and Merging Files with GNU diff and patch|
by David MacKenzie, Paul Eggert, and Richard Stallman
Paperback (6"x9"), 120 pages
RRP £12.95 ($19.95)
"Well packaged... the quality of information is excellent" --- Linux User and Developer Magazine (Issue 36, Feb 2004) Get a printed copy>>>
22.214.171.124 Detailed Description of
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.
format hunks look like this:
change-command to-file-line to-file-line... .
ed uses a single period on a line to indicate the end of
diff protects lines of changes that contain a single
period on a line by writing two periods instead, then writing a
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:
- Add text from the second file after line l in the first file. For example, ‘8a’ means to add the following lines after line 8 of file 1.
- Replace the lines in range r in the first file with the following lines. Like a combined add and delete, but more compact. For example, ‘5,7c’ means change lines 5--7 of file 1 to read as the text file 2.
- Delete the lines in range r from the first file. For example, ‘5,7d’ means delete lines 5--7 of file 1.
|ISBN 0954161750||Comparing and Merging Files with GNU diff and patch||See the print edition|