各种Tips合辑


Tips合辑

==

==

用sed/awk对文件进行处理后,如果需要保存进行的修改,不能直接重定向,否则文件会被截断为空。

Try this:

sed -i -e 's/<em\:update.*//g' install.rdf

When you redirect output to a file in truncate mode, the file is truncated first, before it’s read. Thus, the result is an empty file. Using sed -i avoids this.

Portable (and hopefully not too insecure) solution:

(set -C && sed -e 's/<em\:update.*//g' install.rdf > install.rdf.$$ && mv install.rdf.$$ install.rdf)

🙂

==

Awk的二维数组
搜索关键字:

awk two dimensional array

参考链接:

==

Awk的sub和gsub函数
搜索关键字:

awk gsub

参考链接:
, ,

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注