A quick comment on "1.3 Modifying the '/etc/ttys' file", FreeBSD sed has the
-i option, which makes editing files a bit easier:
Code:
-i extension
Edit files in-place similarly to -I, but treat each file indepen-
dently from other files. In particular, line numbers in each
file start at 1, the ``$'' address matches the last line of the
current file, and address ranges are limited to the current file.
(See Sed Addresses.) The net result is as though each file were
edited by a separate sed instance.
And
Code:
-I extension
Edit files in-place, saving backups with the specified extension.
If a zero-length extension is given, no backup will be saved. It
is not recommended to give a zero-length extension when in-place
editing files, as you risk corruption or partial content in situ-
ations where disk space is exhausted, etc.
Note that in-place editing with -I still takes place in a single
continuous line address space covering all files, although each
file preserves its individuality instead of forming one output
stream. The line counter is never reset between files, address
ranges can span file boundaries, and the ``$'' address matches
only the last line of the last file. (See Sed Addresses.) That
can lead to unexpected results in many cases of in-place editing,
where using -i is desired.