sed -i "/#/d" file-i表示输出到原文件。//中间的是匹配条件d操作符aaa111gggaaabbbsed -n '/^aaa$/{p;n;p;}' a.txt aaa111aaabbb