{"id":6311,"date":"2020-01-19T19:37:36","date_gmt":"2020-01-19T11:37:36","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=6311"},"modified":"2020-01-21T16:27:50","modified_gmt":"2020-01-21T08:27:50","slug":"fgrep","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/fgrep","title":{"rendered":"fgrep\u547d\u4ee4 – \u4e3a\u6587\u4ef6\u641c\u7d22\u6587\u5b57\u5b57\u7b26\u4e32"},"content":{"rendered":"\n
fgrep\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u7528\u6765\u641c\u7d22file\u53c2\u6570\u6307\u5b9a\u7684\u8f93\u5165\u6587\u4ef6\uff08\u7f3a\u7701\u4e3a\u6807\u51c6\u8f93\u5165\uff09\u4e2d\u7684\u5339\u914d\u6a21\u5f0f\u7684\u884c\u3002fgrep \u547d\u4ee4\u7279\u522b\u641c\u7d22Pattern\u53c2\u6570\uff0c\u5b83\u4eec\u662f\u56fa\u5b9a\u7684\u5b57\u7b26\u4e32\u3002\u5982\u679c\u5728File \u53c2\u6570\u4e2d\u6307\u5b9a\u4e00\u4e2a\u4ee5\u4e0a\u7684\u6587\u4ef6fgrep\u547d\u4ee4\u5c06\u663e\u793a\u5305\u542b\u5339\u914d\u884c\u7684\u6587\u4ef6\u3002<\/p>\n\n\n\n
fgrep\u547d\u4ee4 \u4f5c\u7528\u4e0egrep\u548cegrep\u547d\u4ee4\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u641c\u7d22\u5b57\u7b26\u4e32\u800c\u4e0d\u662f\u641c\u7d22\u5339\u914d\u8868\u8fbe\u5f0f\u7684\u6a21\u5f0f\u3002fgrep\u547d\u4ee4\u4f7f\u7528\u5feb\u901f\u7684\u538b\u7f29\u7b97\u6cd5\u3002$, *, [, |, (, )\u548c\\\u7b49\u5b57\u7b26\u4e32\u88abfgrep\u547d\u4ee4\u6309\u5b57\u9762\u610f\u601d\u89e3\u91ca\u3002\u8fd9\u4e9b\u5b57\u7b26\u5e76\u4e0d\u89e3\u91ca\u4e3a\u6b63\u5219\u8868\u8fbe\u5f0f\u3002<\/p>\n\n\n\n
\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u6587\u4ef6\uff0cfgrep\u547d\u4ee4\u5047\u5b9a\u6807\u51c6\u8f93\u5165\u3002\u4e00\u822c\uff0c\u627e\u5230\u7684\u6bcf\u884c\u90fd\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u4e2d\u53bb\u3002\u5982\u679c\u4e0d\u6b62\u4e00\u4e2a\u8f93\u5165\u6587\u4ef6\uff0c\u5219\u5728\u627e\u5230\u7684\u6bcf\u884c\u524d\u6253\u5370\u6587\u4ef6\u540d\u3002<\/p>\n\n\n\n
fgrep\u6709\u4ee5\u4e0b\u76f8\u5173\u5c5e\u6027:<\/p>\n\n\n\n
\u8bed\u6cd5\u683c\u5f0f:<\/strong> fgrep [\u53c2\u6570] <\/p>\n\n\n\n \u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n \u53c2\u8003\u5b9e\u4f8b<\/strong><\/p>\n\n\n\n \u5f53\u524d\u76ee\u5f55\u4e0b\u6240\u6709\u4ee5 .c\u5b57\u7b26\u4e32\u7ed3\u5c3e\u7684\u6587\u4ef6\u4e2d\u641c\u7d22\u5b57\u7b26\u4e32strcpy\uff1a<\/p>\n\n\n\n \u641c\u7d22\u5f53\u524d\u76ee\u5f55\u4e0b\u4ee5 .c \u7ed3\u5c3e\u7684\u6587\u4ef6\uff0c\u7136\u540e\u663e\u793a\u5305\u542b strcpy \u5b57\u7b26\u4e32\u7684\u6587\u4ef6\u540d\uff1a<\/p>\n\n\n\n \u5339\u914d\u542b\u6709a\u7684\u884c\uff1a<\/p>\n\n\n\n fgrep\u547d\u4ee4\u7684\u4f5c\u7528\u662f\u7528\u6765\u641c\u7d22file\u53c2\u6570\u6307\u5b9a\u7684\u8f93\u5165\u6587\u4ef6\uff08\u7f3a\u7701\u4e3a\u6807\u51c6\u8f93\u5165\uff09\u4e2d\u7684\u5339\u914d\u6a21\u5f0f\u7684\u884c\u3002fgrep \u547d\u4ee4\u7279 […]<\/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\/6311"}],"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=6311"}],"version-history":[{"count":7,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6311\/revisions"}],"predecessor-version":[{"id":6539,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6311\/revisions\/6539"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=6311"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=6311"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=6311"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}} -b <\/td> \u5728\u627e\u5230\u7684\u6bcf\u884c\u4e4b\u524d\u6dfb\u52a0\u884c\u6240\u5728\u7684\u5757\u7f16\u53f7<\/td><\/tr> -c<\/td> \u4ec5\u663e\u793a\u5339\u914d\u884c\u7684\u8ba1\u6570<\/td><\/tr> -e<\/td> \u6307\u5b9a\u6a21\u5f0f<\/td><\/tr> -f<\/td> \u6307\u5b9a\u5305\u542b\u5b57\u7b26\u4e32\u7684\u6587\u4ef6<\/td><\/tr> -h<\/td> \u5f53\u591a\u4e2a\u6587\u4ef6\u88ab\u5904\u7406\u65f6\u9690\u85cf\u6587\u4ef6\u540d<\/td><\/tr> -i<\/td> \u5f53\u8fdb\u884c\u6bd4\u8f83\u65f6\u5ffd\u7565\u5b57\u6bcd\u7684\u5927\u5c0f\u5199<\/td><\/tr> -l<\/td> \u53ea\u5217\u51fa\u5305\u542b\u5339\u914d\u884c\u7684\u6587\u4ef6\u540d\uff08\u4e00\u6b21\uff09<\/td><\/tr> n<\/td> \u5c06\u6587\u4ef6\u4e2d\u6bcf\u884c\u7684\u76f8\u5bf9\u884c\u53f7\u7f6e\u4e8e\u884c\u524d<\/td><\/tr> -pSeparator<\/td> \u663e\u793a\u5305\u542b\u5339\u914d\u884c\u7684\u6574\u4e2a\u6bb5\u843d<\/td><\/tr> -q<\/td> \u7981\u6b62\u6240\u6709\u5199\u5165\u5230\u6807\u51c6\u8f93\u51fa\u7684\u64cd\u4f5c\uff0c\u4e0d\u7ba1\u662f\u5426\u4e3a\u5339\u914d\u884c<\/td><\/tr> -s<\/td> \u4ec5\u663e\u793a\u51fa\u9519\u6d88\u606f<\/td><\/tr> -v<\/td> \u663e\u793a\u9664\u4e86\u5339\u914d\u7279\u5b9a\u6a21\u5f0f\u7684\u884c\u4ee5\u5916\u7684\u6240\u6709\u884c<\/td><\/tr> -w<\/td> \u6267\u884c\u5355\u8bcd\u641c\u7d22<\/td><\/tr> -x<\/td> \u663e\u793a\u5339\u914d\u6a21\u5f0f\u7684\u884c\uff0c\u8981\u6c42\u65e0\u989d\u5916\u7684\u5b57\u7b26<\/td><\/tr> -y<\/td> \u5f53\u8fdb\u884c\u6bd4\u8f83\u65f6\u5ffd\u7565\u5b57\u7b26\u7684\u5927\u5c0f\u5199<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n [root@linuxcool ~]# fgrep strcpy *.c<\/pre>\n\n\n\n
[root@linuxcool ~]# fgrep -l strcpy *.c<\/pre>\n\n\n\n
[root@linuxcool ~]# cat linuxcool.sh |fgrep a<\/pre>\n","protected":false},"excerpt":{"rendered":"