代码改变世界

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

  AlfredZhao  阅读(812)  评论(0编辑  收藏  举报

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

效果如下:

[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.

相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2020-06-30 小知识:如何判定当前连接系统是否为虚拟机
2020-06-30 小知识:如何配置OSW添加私网监控
2020-06-30 小知识:如何修改TFA下的OSW数据保留时间
点击右上角即可分享
微信分享提示