{"id":6307,"date":"2020-01-19T19:38:13","date_gmt":"2020-01-19T11:38:13","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=6307"},"modified":"2022-06-11T14:42:49","modified_gmt":"2022-06-11T06:42:49","slug":"egrep","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/egrep","title":{"rendered":"egrep\u547d\u4ee4 – \u5728\u6587\u4ef6\u5185\u67e5\u627e\u6307\u5b9a\u7684\u5b57\u7b26\u4e32"},"content":{"rendered":"\n

egrep\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cextended Global Regular Expression Print\u201d\u7684\u7f29\u5199\uff0c\u5176\u529f\u80fd\u662f\u7528\u4e8e\u5728\u6587\u4ef6\u5185\u67e5\u627e\u6307\u5b9a\u7684\u5b57\u7b26\u4e32\u3002egrep\u547d\u4ee4\u7684\u6267\u884c\u6548\u679c\u4e0egrep -E\u76f8\u4f3c\uff0c\u4f7f\u7528\u53c2\u6570\u4e5f\u53ef\u4ee5\u76f4\u63a5\u53c2\u8003grep\u547d\u4ee4\uff0c\u4e0d\u540c\u70b9\u5728\u4e8e\u6539\u826f\u4e86grep\u547d\u4ee4\u539f\u6709\u7684\u4e00\u4e9b\u5b57\u7b26\u4e32\u5904\u7406\u529f\u80fd\uff0c\u652f\u6301\u4e86\u66f4\u591a\u6b63\u5219\u8868\u8fbe\u5f0f\u89c4\u5219\u3002<\/p>\n\n\n\n

\u8bed\u6cd5\u683c\u5f0f\uff1a<\/strong>egrep [\u53c2\u6570] \u6587\u4ef6<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n

-i<\/td>\u5ffd\u7565\u5927\u5c0f\u5199<\/td><\/tr>
-c<\/td>\u53ea\u8f93\u51fa\u5339\u914d\u884c\u7684\u6570\u91cf<\/td><\/tr>
-l<\/td>\u53ea\u5217\u51fa\u7b26\u5408\u5339\u914d\u7684\u6587\u4ef6\u540d<\/td><\/tr>
-n<\/td>\u663e\u793a\u884c\u53f7<\/td><\/tr>
-h<\/td>\u4e0d\u663e\u793a\u6587\u4ef6\u540d<\/td><\/tr>
-s<\/td>\u4e0d\u663e\u793a\u9519\u8bef\u4fe1\u606f<\/td><\/tr>
-v<\/td>\u5185\u5bb9\u53cd\u9009<\/td><\/tr>
-w<\/td>\u5339\u914d\u6574\u8bcd<\/td><\/tr>
-x<\/td>\u5339\u914d\u6574\u884c<\/td><\/tr>
-r<\/td>\u9012\u5f52\u641c\u7d22<\/td><\/tr>
-q<\/td>\u7981\u6b62\u8f93\u51fa\u4efb\u4f55\u7ed3\u679c<\/td><\/tr>
-b<\/td>\u6253\u5370\u5339\u914d\u884c\u8ddd\u6587\u4ef6\u5934\u90e8\u7684\u504f\u79fb\u91cf<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

\u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n

\u5728\u67d0\u4e2a\u6587\u4ef6\u4e2d\u641c\u7d22\u5305\u542b\u6307\u5b9a\u5173\u952e\u8bcd\u7684\u884c\uff08\u5355\u4e00\u5173\u952e\u8bcd\uff09\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# egrep 'root' anaconda-ks.cfg <\/strong>\nrootpw --iscrypted $6$c2VGkv\/8C3IEwtRt$iPEjNXml6v5KEmcM9okIT.Op9\/LEpFejqR.kmQWAVX7fla3roq.3MMVKDahnv0l\/pONz2WMNecy17WJ8Ib0iO1\npwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty<\/pre>\n\n\n\n

\u5728\u67d0\u4e2a\u6587\u4ef6\u4e2d\u641c\u7d22\u5305\u542b\u6307\u5b9a\u5173\u952e\u8bcd\u7684\u884c\u5e76\u663e\u793a\u884c\u53f7\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# egrep -n 'root|linuxprobe' anaconda-ks.cfg <\/strong>\r\n18:network  --hostname=linuxprobe.com\r\n20:rootpw --iscrypted $6$c2VGkv\/8C3IEwtRt$iPEjNXml6v5KEmcM9okIT.Op9\/LEpFejqR.kmQWAVX7fla3roq.3MMVKDahnv0l\/pONz2WMNecy17WJ8Ib0iO1\r\n40:pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty<\/pre>\n\n\n\n

\u5728\u67d0\u4e2a\u6587\u4ef6\u4e2d\u641c\u7d22\u5305\u542b\u6307\u5b9a\u5173\u952e\u8bcd\u7684\u884c\uff0c\u5c06\u5339\u914d\u5185\u5bb9\u53cd\u9009\u540e\u5c06\u7ed3\u679c\u8f93\u51fa\u5230\u5c4f\u5e55\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# egrep -v 'root|linuxprobe' anaconda-ks.cfg <\/strong>\r\n#version=RHEL8\r\nignoredisk --only-use=sda\r\nautopart --type=lvm\r\n# Partition clearing information\r\nclearpart --none --initlabel\r\n# Use graphical install\r\ngraphical\r\nrepo --name=\"AppStream\" --baseurl=file:\/\/\/run\/install\/repo\/AppStream\r\n# Use CDROM installation media\n\u2026\u2026\u2026\u2026\u2026\u2026\u7701\u7565\u90e8\u5206\u8f93\u51fa\u4fe1\u606f\u2026\u2026\u2026\u2026\u2026\u2026\r<\/pre>\n\n\n\n

\u5728\u67d0\u4e2a\u6587\u4ef6\u4e2d\u641c\u7d22\u5305\u542b\u6307\u5b9a\u5173\u952e\u8bcd\u7684\u884c\uff08\u591a\u4e2a\u5173\u952e\u8bcd\uff0c\u6709\u4efb\u610f\u4e00\u4e2a\u5373\u6ee1\u8db3\u6761\u4ef6\uff09\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# egrep 'root|linuxprobe' anaconda-ks.cfg <\/strong>\nnetwork  --hostname=linuxprobe.com\nrootpw --iscrypted $6$c2VGkv\/8C3IEwtRt$iPEjNXml6v5KEmcM9okIT.Op9\/LEpFejqR.kmQWAVX7fla3roq.3MMVKDahnv0l\/pONz2WMNecy17WJ8Ib0iO1\npwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty<\/pre>\n","protected":false},"excerpt":{"rendered":"

egrep\u547d\u4ee4\u6765\u81ea\u4e8e\u82f1\u6587\u8bcd\u7ec4\u201cextended Global Regular Expression Print […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6307"}],"collection":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/comments?post=6307"}],"version-history":[{"count":11,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6307\/revisions"}],"predecessor-version":[{"id":10284,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6307\/revisions\/10284"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=6307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=6307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=6307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}