2个稳定版本
1.0.1 | 2019年10月8日 |
---|---|
1.0.0 | 2019年5月5日 |
#5 in #sponge
4KB
58 行
rw
类似于 sponge,但没有moreutils厨房水槽。
cat example.txt | grep -v exclude | rw example.txt
rw
("重写") 允许您将一个命令的stdout重定向到文件,即使您正在使用该文件生成stdout。如果您使用标准shell重定向尝试这样做,您将无法在读取文件之前截断文件!
# This causes example.txt to be empty
# Shell redirection would truncate the file, before the cat utility read it
cat example.txt | grep -v exclude > example.txt
用法
rw [-a] FILE
追加到文件
使用-
将追加到输出文件,而不是覆盖它。
依赖关系
~445KB