Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php): failed to open stream: No such file or directory in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: include(): Failed opening '/home/blog66rr/public_html/wp-content/plugins/hyper-cache/cache.php' for inclusion (include_path='.:/opt/cpanel/ea-php70/root/usr/share/pear') in /home/blog66rr/public_html/wp-content/advanced-cache.php on line 24

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723

Warning: Cannot modify header information - headers already sent by (output started at /home/blog66rr/public_html/wp-content/advanced-cache.php:24) in /home/blog66rr/public_html/wp-includes/rest-api/class-wp-rest-server.php on line 1723
{"id":2074,"date":"2015-11-03T16:03:42","date_gmt":"2015-11-03T08:03:42","guid":{"rendered":"http:\/\/blog.unethost.com\/?p=2074"},"modified":"2015-11-03T16:07:16","modified_gmt":"2015-11-03T08:07:16","slug":"how_to_use_linux_grep_and_output_it_to_another_data","status":"publish","type":"post","link":"https:\/\/blog.unethost.com\/how_to_use_linux_grep_and_output_it_to_another_data\/","title":{"rendered":"\u5982\u4f55\u64cd\u4f5c linux grep \u6307\u4ee4\uff0c\u641c\u7d22\u5167\u6587\u6216\u662f\u532f\u51fa\u3002"},"content":{"rendered":"

\"linux_grep_wp\"<\/a><\/p>\n

\u8981\u5728\u5927\u91cf\u7684\u6587\u4ef6\u4e2d\uff0c\u627e\u51fa\u76f8\u5c0d\u7684\u5167\u5bb9\uff0c\u4e26\u4e14\u532f\u51fa\u3002\u9019\u6642\u5982\u679c\u662f\u4f7f\u7528linux\u7576server\uff0c
\n\u53ea\u8981\u767b\u5165shell\u5f8c\uff0c\u5728\u900f\u904e grep \u7684\u6307\u4ee4\u5c31\u53ef\u4ee5\u5feb\u901f\u627e\u51fa\u6587\u4ef6\u6216\u662f\u532f\u51fa\u5167\u5bb9\u3002<\/p>\n

<\/p>\n

\u4fee\u6539 theme\u70ba\u4f8b<\/span><\/h1>\n

\u5f88\u591a\u514d\u8cbb\u7248\u6a21\uff0c\u5982\u679c\u60f3\u5728\u7248\u6a21\u7684\u4e0b\u65b9\u6539\u6389\u539f\u672c\u7684\u516c\u53f8\u8cc7\u8a0a\uff0c\u6216\u662f\u589e\u52a0\u81ea\u5df1\u7684\u8cc7\u8a0a\uff0c
\n\u9019\u6642\u53ea\u8981\u767b\u5165 shell \uff0c\u4e26\u767b\u5165\u76f8\u5c0d\u61c9\u7684\u8cc7\u6599\u593e(\u6bd4\u65b9\u8aaa \/template)
\n\u8f38\u5165\u8a9e\u6cd5\u70ba\uff1a grep ‘Power’ *\u00a0 \u6216 grep -r ‘Power’ *
\n(\u589e\u52a0 -r \u53c3\u6578\uff0c\u624d\u6703\u5728\u91dd\u5c0d\u5b50\u8cc7\u6599\u593e\u4e0b\u53bb\u641c\u7d22\u5167\u5bb9)<\/p>\n

\u5982\u4e0b\u65b9\u5716\u7247\u6240\u793a\uff0c\u9810\u8a2d\u662fprint\u5728screen\u4e0a\u9762\uff0c\u5c31\u6703\u641c\u7d22\u51fa\u8a72\u5167\u5bb9\u51fa\u73fe\u5728\u54ea\u4e00\u96bb\u7a0b\u5f0f\u88e1\uff0c\u5c31\u53ef\u4ee5\u5728\u900f\u904evim\u6216\u662fnano\u6307\u4ee4<\/a>\u53bb\u4fee\u6539\u8a72\u6a94\u3002<\/p>\n

\"linux_grep01\"<\/a><\/p>\n

\u5982\u679c\u662f\u67e5\u627elog\u6a94\uff0c
\n\u60f3\u8981\u532f\u51fa\u7279\u5b9a\u7684\u8cc7\u6599\u5462?<\/span><\/h1>\n

\u6709\u6642\u9700\u8981\u904e\u6ffelog\u6a94\uff0c\u5c07\u7279\u5b9a\u767b\u5165\u5e33\u865f\u7684\u8a18\u9304\u53d6\u51fa\uff0c\u5982\u679c\u662f\u5f9e\u5bc6\u5bc6\u9ebb\u9ebb\u7684log\u6a94\uff0c
\n\u7528\u4eba\u5de5\u53bb\u770b\uff0c\u662f\u76f8\u7576\u8f9b\u82e6\u7684\u4e8b\uff0c\u4f46\u7528grep\u6307\u4ee4\uff0c\u5c31\u6703\u8f15\u9b06\u4e0d\u5c11\u3002<\/p>\n

\u5728linux shell \u4e0b\uff0c \u8f38\u5165\uff1a\u00a0\u00a0grep ‘unethost’ access_log > log.txt
\nunethost\u53ef\u4ee5\u6539\u6210\u7279\u5b9a\u5b57\u4e32\u7684\u540d\u7a31\uff0c\u7136\u5f8c\u641c\u7d22\u5230\u5f8c\uff0c\u5c31\u6703\u532f\u51fa\u5230 log.txt \u6a94\u5167\u3002<\/p>\n

 <\/p>\n

\u4eca\u5929\u5148\u7c21\u55ae\u7684\u4ecb\u7d39\u5169\u7a2e\u7528\u6cd5\uff0c\u6709\u6a5f\u6703\u6211\u5011\u6703\u4ecb\u7d39\u66f4\u591a\u7684linux\u6307\u4ee4\u53ca\u5176\u61c9\u7528\u3002<\/span><\/p>\n

 <\/p>\n

(\u672c\u7bc7\u6587\u7ae0\u7531unethost.com\u5ba2\u670d\u4eba\u54e1<\/a>-Michael\u5b8c\u6210)<\/strong><\/p>\n

\u8a3b\u518a\u7db2\u57df\u8acb\u9ede\u6211<\/a>\u3002\u6211\u5011\u63d0\u4f9b\u865b\u64ec\u4e3b\u6a5f\u8a66\u7528\uff0c\u4e03\u5929\u6eff\u610f\u4fdd\u8b49\uff0c<\/span><\/strong>
\n \u529f\u80fd\u5b8c\u6574\u4f7f\u7528\u4e0d\u53d7\u9650\u5236\uff0c\u6b61\u8fce
\u9ede\u6211<\/a>\u7533\u8acb\u3002<\/span><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"

\u8981\u5728\u5927\u91cf\u7684\u6587\u4ef6\u4e2d\uff0c\u627e\u51fa\u76f8\u5c0d\u7684\u5167\u5bb9\uff0c\u4e26\u4e14\u532f\u51fa\u3002\u9019\u6642\u5982\u679c\u662f\u4f7f\u7528linux\u7576server\uff0c \u53ea\u8981\u767b\u5165shell\u5f8c\uff0c\u5728 … \u95b1\u8b80\u5168\u6587 \u5982\u4f55\u64cd\u4f5c linux grep \u6307\u4ee4\uff0c\u641c\u7d22\u5167\u6587\u6216\u662f\u532f\u51fa\u3002<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[226],"tags":[416,415,413,414],"_links":{"self":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/2074"}],"collection":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/comments?post=2074"}],"version-history":[{"count":4,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/2074\/revisions"}],"predecessor-version":[{"id":2081,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/posts\/2074\/revisions\/2081"}],"wp:attachment":[{"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/media?parent=2074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/categories?post=2074"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.unethost.com\/wp-json\/wp\/v2\/tags?post=2074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}