- 论坛徽章:
- 0
|
# man sed
-i[SUFFIX], --in-place[=SUFFIX]
edit files in place (makes backup if extension sup-
plied). The default operation mode is to break
symbolic and hard links. This can be changed with
--follow-symlinks and --copy.
-c, --copy
use copy instead of rename when shuffling files in
-i mode. While this will avoid breaking links
(symbolic or hard), the resulting editing operation
is not atomic. This is rarely the desired mode;
--follow-symlinks is usually enough, and it is both
faster and more secure.
1. -i :The default operation mode is to break symbolic and hard links.
break symbolic and hard links是什么意思?
是不是这样的:
sed -i PATTERN file
sed先创建一个新空白文件 按照PATTERN过滤file到这个新空白文件 等待全部处理完成后 直接修改文件系统的file文件名指向这个新的文件 而老的file数据区域后来被sed删除掉(当没有备份要求时)在这种情况下 这个操作就是原子的!
2. -c : use copy instead of rename when shuffling files in
-i mode. While this will avoid breaking links
(symbolic or hard), the resulting editing operation
is not atomic.
这个是不是说 如果 sed -c PATTERN file 在其正在处理file的时候 若有人去读这个文件 他读到的就是正在处理中的文件?
请各位朋友指教!
|
|