{"id":6368,"date":"2020-01-19T19:51:06","date_gmt":"2020-01-19T11:51:06","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=6368"},"modified":"2020-01-21T16:33:00","modified_gmt":"2020-01-21T08:33:00","slug":"gawk","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/gawk","title":{"rendered":"gawk\u547d\u4ee4 – \u6a21\u5f0f\u626b\u63cf\u4e0e\u5904\u7406\u8bed\u8a00"},"content":{"rendered":"\n

gawk\u662fUnix\u4e2d\u539f\u59cbawk\u7a0b\u5e8f\u7684GNU\u7248\u672c,\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u53ef\u4ee5\u5199\u811a\u672c\u6765\u8bfb\u53d6\u6587\u672c\u884c\u7684\u6570\u636e\uff0c\u7136\u540e\u5904\u7406\u5e76\u663e\u793a\u6570\u636e\u3002<\/p>\n\n\n\n

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

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

-f<\/td>\u4ece\u6587\u4ef6\u7a0b\u5e8f\u6587\u4ef6\u8bfb\u53d6AWK\u7a0b\u5e8f\u6e90\uff0c\u800c\u4e0d\u662f\u4ece\u7b2c\u4e00\u4e2a\u547d\u4ee4\u884c\u53c2\u6570\u3002\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a-f\uff08\u6216--file\uff09\u9009\u9879<\/td><\/tr>
-F<\/td>\u6307\u5b9a\u63cf\u7ed8\u4e00\u884c\u4e2d\u6570\u636e\u5b57\u6bb5\u7684\u6587\u4ef6\u5206\u9694\u7b26<\/td><\/tr>
-v<\/td>\u5b9a\u4e49gawk\u7a0b\u5e8f\u4e2d\u4f7f\u7528\u7684\u53d8\u91cf\u548c\u9ed8\u8ba4\u503c<\/td><\/tr>
-mr<\/td>\u6307\u5b9a\u6570\u636e\u6587\u4ef6\u4e2d\u7684\u6700\u5927\u8bb0\u5f55\u5927\u5c0f<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n

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

\u547d\u4ee4\u884c\u8bfb\u53d6\u7a0b\u5e8f\u811a\u672c\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# gawk '{print \"hello world\"}'<\/pre>\n\n\n\n

\u6307\u5b9a\u63cf\u7ed8\u4e00\u884c\u4e2d\u6570\u636e\u5b57\u6bb5\u7684\u6587\u4ef6\u5206\u9694\u7b26\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# gawk -F: '{print $1}' \/etc\/passwd<\/pre>\n","protected":false},"excerpt":{"rendered":"

gawk\u662fUnix\u4e2d\u539f\u59cbawk\u7a0b\u5e8f\u7684GNU\u7248\u672c,\u5f3a\u5927\u4e4b\u5904\u5728\u4e8e\u53ef\u4ee5\u5199\u811a\u672c\u6765\u8bfb\u53d6\u6587\u672c\u884c\u7684\u6570\u636e\uff0c\u7136\u540e\u5904\u7406\u5e76\u663e\u793a\u6570\u636e\u3002 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6368"}],"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=6368"}],"version-history":[{"count":6,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6368\/revisions"}],"predecessor-version":[{"id":6551,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/6368\/revisions\/6551"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=6368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=6368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=6368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}