删除文件以#开头的所有行 [英] Delete all lines beginning with a # from a file
本文介绍了删除文件以#开头的所有行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所有在文件注释行与#
开始。如何删除所有与#
开头的行(只有那些线)?包含其他行#
,但不是在该行的开头应被忽略。
All of the lines with comments in a file begin with #
. How can I delete all of the lines (and only those lines) which begin with #
? Other lines containing #
, but not at the beginning of the line should be ignored.
推荐答案
这可以被用做单行:
sed '/^#/ d'
本说,发现以#开头,并删除它们的所有行,离开一切。
This says, "find all lines that start with # and delete them, leaving everything else."
这篇关于删除文件以#开头的所有行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文