sed查找替换空行 1,复制一个带有空行的文件,或者创建一个 cp /etc/profile . cat profile 对空行进行替换 cat profile | sed -nr 's@^[^$]@@p'