Next: Forward ed
Scripts, Up: Making Edit Scripts [Contents][Index]
ed
Scripts ¶
diff
can produce commands that direct the ed
text editor to change the first file into the second file. Long ago, this was the only output mode that was suitable for editing one file into another automatically; today, with patch
, it is almost obsolete. Use the --ed (-e) option to select this output format.
Like the normal format (see Showing Differences Without Context), this output format does not show any context; unlike the normal format, it does not include the information necessary to apply the diff in reverse (to produce the first file if all you have is the second file and the diff).
If the file d contains the output of ‘diff -e old new’, then the command ‘(cat d && echo w) | ed - old’ edits old to make it a copy of new. More generally, if d1, d2, …, dN contain the outputs of ‘diff -e old new1’, ‘diff -e new1 new2’, …, ‘diff -e newN-1 newN’, respectively, then the command ‘(cat d1 d2 … dN && echo w) | ed - old’ edits old to make it a copy of newN.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4