小知识:grep过滤以#号开头的注释行 和 空行

2023-10-10 18:09:09 浏览数 (1)

xtts的配置文件,有很多注释不想直接去掉的情况下,想清楚的看到目前设置了哪些参数,可以用grep过滤查看: grep -vE '^#|^$' xtt.properties

效果如下:

代码语言:javascript复制
[oracle@db11gcas xtt]$ grep -vE '^#|^$' xtt.properties
tablespaces=DBS_D_JINGYU, DBS_I_JINGYU
platformid=13
src_scratch_location=/u01/media/src_backups/
dest_datafile_location= DATADG
dest_scratch_location=/xtts/
parallel=3
rollparallel=2
getfileparallel=4
destconnstr=sys/oracle@jingyu
allowstandby=1

简单来说,E是正则,v是反向匹配,^$ 是空行,^#是#开头的:

-E, --extended-regexp Interpret PATTERN as an extended regular expression (ERE, see below). (-E is specified by POSIX.) -v, --invert-match Invert the sense of matching, to select non-matching lines. (-v is specified by POSIX.) Anchoring The caret ^ and the dollar sign $ are meta-characters that respectively match the empty string at the beginning and end of a line.

0 人点赞