对于措辞不佳的问题表示歉意,但是当我查看中的-i
切换时man sed
,我会看到:
-i[SUFFIX], --in-place[=SUFFIX] edit files in place (makes backup if SUFFIX supplied)
就这样。
但后来我碰上了快速笔记到位选项的sed的编辑与更长的解释sed -i
也从手册页:
From the sed manpage:
-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.
因此,在哪里可以访问更详细的手册页?有人知道更详尽的版本的来源吗?
您发现的可能是Mac OS X系统上sed实用程序的手册页,该手册页与您在Ubuntu上使用的sed实用程序不同。据我所知,Mac OS X上的sed实用程序起源于BSD Unix,而Ubuntu上的sed实用程序是由GNU项目编写的。
如果您需要有关a的更详细的文档,GNU utility
则值得打开其info
文档而不是其手册页。在GNU项目中,手册页是次要的。例如,看一下-i
在sedinfo
页面上可以找到的关于该选项的内容:
`-i[SUFFIX]' `--in-place[=SUFFIX]' This option specifies that files are to be edited in-place. GNU `sed' does this by creating a temporary file and sending output to this file rather than to the standard output.(1). This option implies `-s'. When the end of the file is reached, the temporary file is renamed to the output file's original name. The extension, if supplied, is used to modify the name of the old file before renaming the temporary file, thereby making a backup copy(2)). This rule is followed: if the extension doesn't contain a `*', then it is appended to the end of the current filename as a suffix; if the extension does contain one or more `*' characters, then _each_ asterisk is replaced with the current filename. This allows you to add a prefix to the backup file, instead of (or in addition to) a suffix, or even to place backup copies of the original files into another directory (provided the directory already exists). If no extension is supplied, the original file is overwritten without making a backup.
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句