{"id":454,"date":"2013-09-19T19:38:32","date_gmt":"2013-09-19T19:38:32","guid":{"rendered":"https:\/\/shan.info\/new\/awk%e4%b8%ad%e4%bd%bf%e7%94%a8shell%e7%9a%84%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f\/"},"modified":"2013-09-19T19:38:32","modified_gmt":"2013-09-19T19:38:32","slug":"awk%e4%b8%ad%e4%bd%bf%e7%94%a8shell%e7%9a%84%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f","status":"publish","type":"post","link":"https:\/\/shan.info\/new\/awk%e4%b8%ad%e4%bd%bf%e7%94%a8shell%e7%9a%84%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f\/","title":{"rendered":"awk\u4e2d\u4f7f\u7528shell\u7684\u73af\u5883\u53d8\u91cf"},"content":{"rendered":"<p><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">awk\u4e2d\u4f7f\u7528shell\u7684\u73af\u5883\u53d8\u91cf<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u4e00:&#8221;&#8216;$var'&#8221;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u8fd9\u79cd\u5199\u6cd5\u5927\u5bb6\u65e0\u9700\u6539\u53d8\u7528&#8217;\u62ec\u8d77awk\u7a0b\u5e8f\u7684\u4e60\u60ef,\u662f\u8001\u5916\u5e38\u7528\u7684\u5199\u6cd5.\u5982:<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">var=&#8221;test&#8221;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">awk&nbsp;&#8216;BEGIN{print&nbsp;&#8220;&#8216;$var'&#8221;}&#8217;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u8fd9\u79cd\u5199\u6cd5\u5176\u5b9e\u9645\u662f\u53cc\u62ec\u53f7\u53d8\u4e3a\u5355\u62ec\u53f7\u7684\u5e38\u91cf,\u4f20\u9012\u7ed9\u4e86awk.<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u5982\u679cvar\u4e2d\u542b\u7a7a\u683c,\u4e3a\u4e86shell\u4e0d\u628a\u7a7a\u683c\u4f5c\u4e3a\u5206\u683c\u7b26,\u4fbf\u5e94\u8be5\u5982\u4e0b\u4f7f\u7528:<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">awk&nbsp;&#8216;BEGIN{print&nbsp;&#8220;&#8216;&#8221;$var&#8221;&#8216;&#8221;}&#8217;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u4e8c:'&#8221;$var&#8221;&#8216;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u8fd9\u79cd\u5199\u6cd5\u4e0e\u4e0a\u4e00\u79cd\u7c7b\u4f3c.\u5982\u679c\u53d8\u91cf\u542b\u7a7a\u683c,\u5219\u53d8\u4e3a'&#8221;&#8221;$var&#8221;&#8221;&#8216;\u8f83\u4e3a\u53ef\u9760.<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u4e09.\u628a\u62ec\u8d77awk\u7a0b\u5e8f\u7684&#8221;\u53d8\u4e3a&#8221;&#8221;,\u4f7f\u7528&#8221;$var&#8221;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u5982:<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">$var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">awk&nbsp;&#8216;BEGIN{print&nbsp;&#8220;$var&#8221;}&#8221;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u8fd9\u662f\u56e0\u4e3a\u5728&#8221;&#8221;\u91cc$\u662f\u7279\u6b8a\u5b57\u7b26,\u800c\u5728&#8221;\u91cc$\u662f\u666e\u901a\u5b57\u7b26.<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u56db:export&nbsp;\u53d8\u91cf,\u4f7f\u7528ENVIRON[&#8220;var&#8221;]\u5f62\u5f0f,<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u5982:<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">$var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;;export&nbsp;$var<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">awk&nbsp;&#8216;BEGIN{print&nbsp;ENVIRON[&#8220;var&#8221;]}&#8217;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u4e94:\u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528-v\u9009\u9879<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u5982:<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">$var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">awk&nbsp;-vnvar=&#8221;$var&#8221;&nbsp;&#8216;{print&nbsp;nvar}&#8217;<\/span><br style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\" \/><span style=\"color: #333333; font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 24px; background-color: #f5f5f5;\">\u8fd9\u6837\u4fbf\u628a\u7cfb\u7edf\u53d8\u91cf\u5b9a\u4e49\u6210\u4e86awk\u53d8\u91cf.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>awk\u4e2d\u4f7f\u7528shell\u7684\u73af\u5883\u53d8\u91cf\u4e00:&#8221;&#8216;$var&#8217;&#8221;\u8fd9\u79cd\u5199\u6cd5\u5927\u5bb6\u65e0\u9700\u6539\u53d8\u7528&#8217;\u62ec\u8d77awk\u7a0b\u5e8f\u7684\u4e60\u60ef,\u662f\u8001\u5916\u5e38\u7528\u7684\u5199\u6cd5.\u5982:var=&#8221;test&#8221;awk&nbsp;&#8216;BEGIN{print&nbsp;&#8220;&#8216;$var&#8217;&#8221;}&#8217;\u8fd9\u79cd\u5199\u6cd5\u5176\u5b9e\u9645\u662f\u53cc\u62ec\u53f7\u53d8\u4e3a\u5355\u62ec\u53f7\u7684\u5e38\u91cf,\u4f20\u9012\u7ed9\u4e86awk.\u5982\u679cvar\u4e2d\u542b\u7a7a\u683c,\u4e3a\u4e86shell\u4e0d\u628a\u7a7a\u683c\u4f5c\u4e3a\u5206\u683c\u7b26,\u4fbf\u5e94\u8be5\u5982\u4e0b\u4f7f\u7528:var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;awk&nbsp;&#8216;BEGIN{print&nbsp;&#8220;&#8216;&#8221;$var&#8221;&#8216;&#8221;}&#8217;\u4e8c:&#8217;&#8221;$var&#8221;&#8216;\u8fd9\u79cd\u5199\u6cd5\u4e0e\u4e0a\u4e00\u79cd\u7c7b\u4f3c.\u5982\u679c\u53d8\u91cf\u542b\u7a7a\u683c,\u5219\u53d8\u4e3a&#8217;&#8221;&#8221;$var&#8221;&#8221;&#8216;\u8f83\u4e3a\u53ef\u9760.\u4e09.\u628a\u62ec\u8d77awk\u7a0b\u5e8f\u7684&#8221;\u53d8\u4e3a&#8221;&#8221;,\u4f7f\u7528&#8221;$var&#8221;\u5982:$var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;awk&nbsp;&#8216;BEGIN{print&nbsp;&#8220;$var&#8221;}&#8221;\u8fd9\u662f\u56e0\u4e3a\u5728&#8221;&#8221;\u91cc$\u662f\u7279\u6b8a\u5b57\u7b26,\u800c\u5728&#8221;\u91cc$\u662f\u666e\u901a\u5b57\u7b26.\u56db:export&nbsp;\u53d8\u91cf,\u4f7f\u7528ENVIRON[&#8220;var&#8221;]\u5f62\u5f0f,\u5982:$var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;;export&nbsp;$varawk&nbsp;&#8216;BEGIN{print&nbsp;ENVIRON[&#8220;var&#8221;]}&#8217;\u4e94:\u5f53\u7136\u4e5f\u53ef\u4ee5\u4f7f\u7528-v\u9009\u9879\u5982:$var=&#8221;this&nbsp;is&nbsp;a&nbsp;test&#8221;awk&nbsp;-vnvar=&#8221;$var&#8221;&nbsp;&#8216;{print&nbsp;nvar}&#8217;\u8fd9\u6837\u4fbf\u628a\u7cfb\u7edf\u53d8\u91cf\u5b9a\u4e49\u6210\u4e86awk\u53d8\u91cf.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33],"tags":[],"class_list":["post-454","post","type-post","status-publish","format-standard","hentry","category-centos-6"],"_links":{"self":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/comments?post=454"}],"version-history":[{"count":0,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/posts\/454\/revisions"}],"wp:attachment":[{"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/media?parent=454"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/categories?post=454"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/shan.info\/new\/wp-json\/wp\/v2\/tags?post=454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}