- 論壇徽章:
- 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先創(chuàng)建一個新空白文件 按照PATTERN過濾file到這個新空白文件 等待全部處理完成后 直接修改文件系統(tǒng)的file文件名指向這個新的文件 而老的file數(shù)據(jù)區(qū)域后來被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的時候 若有人去讀這個文件 他讀到的就是正在處理中的文件?
請各位朋友指教!
|
|