chr*_*000 11 sed awk perl text-processing regular-expression
#鉴于 的左侧和右侧可能有空格,如何删除以 a 开头的行#?
# Master socket provides access to userdb information. It's typically
Run Code Online (Sandbox Code Playgroud)
roz*_*acz 10
您可以使用grep该
grep -vh '^[[:space:]]*#' filename
Run Code Online (Sandbox Code Playgroud)
由于我认为您正在从某个文件中删除注释,因此您还可以考虑删除空行,从而将上述内容扩展为:
grep -vh '^[[:space:]]*\(#\|$\)' filename
Run Code Online (Sandbox Code Playgroud)