Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想显示包含空行和特殊字符 (?#!%#) 的行。我将 grep 命令用于特殊字符,但它不适用于空行。
grep -n '[]?#!*%[]' file
如果有人可以请试试这个?谢谢
您可以使用选项指定多个模式-e,因此除了当前模式之外,您还可以为仅包含空白的行提供另一种模式:
-e
grep -n -e '[]?#!*%[]' -e '^ *$' file