{"id":942,"date":"2024-06-29T10:28:00","date_gmt":"2024-06-29T02:28:00","guid":{"rendered":"http:\/\/blue.yn.cn\/?p=942"},"modified":"2024-12-16T20:47:31","modified_gmt":"2024-12-16T12:47:31","slug":"%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e4%b8%8egrep%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"http:\/\/blue.yn.cn\/?p=942","title":{"rendered":"\u5e38\u7528\u547d\u4ee4grep-sed"},"content":{"rendered":"<h3>\u6b63\u5219\u8868\u8fbe\u5f0f\u4ecb\u7ecd<\/h3>\n<h4>\u4ec0\u4e48\u662f\u6b63\u5219\u8868\u8fbe\u5f0f<\/h4>\n<ul>\n<li>\u4ee5\u7279\u5b9a\u7684\u7b26\u53f7<em>\u8868\u793a\u4e00\u7ec4\u6570\u5b57\u6216\u5b57\u6bcd\u7684<\/em>\uff0c\u4e00\u79cd\u89c4\u5219\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"\/wp-content\/uploads\/2024\/06\/image-1719628997390.png\" alt=\"file\" \/><\/p>\n<h4>\u4e3a\u4f55\u9700\u8981\u6b63\u5219\u8868\u8fbe\u5f0f<\/h4>\n<ul>\n<li>\u5728\u5de5\u4f5c\u4e2d\uff0c\u6211\u4eec\u65f6\u523b\u9762\u5bf9\u7740\u5927\u91cf\u7684\u65e5\u5fd7\u3001\u7a0b\u5e8f\u4ee5\u53ca\u547d\u4ee4\u7684\u8f93\u51fa\u3002\u8feb\u5207\u7684\u9700\u8981\u8fc7\u6ee4\u6211\u4eec\u9700\u8981\u7684\u4e00\u90e8\u5206\u5185\u5bb9\uff0c\u751a\u81f3\u662f\u4e00\u4e2a\u5b57\u7b26\u4e32<\/li>\n<li>\u6bd4\u5982\uff1a\u73b0\u5728\u6709\u4e00\u4e2a\u4e0a\u5343\u884c\u7684\u6587\u4ef6\uff0c\u6211\u4eec\u4ec5\u9700\u8981\u5176\u4e2d\u5305\u542b<code>error<\/code>\u7684\u884c\uff0c\u600e\u4e48\u529e\uff1f\u6b64\u65f6\u5c31\u9700\u8981\u4f7f\u7528\u5230\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u89c4\u5219\u6765\u7b5b\u9009\u60f3\u8981\u7684\u5185\u5bb9<\/li>\n<\/ul>\n<h4>\u6b63\u5219\u8868\u8fbe\u5f0f\u6ce8\u610f\u4e8b\u9879<\/h4>\n<ul>\n<li>1.\u6b63\u5219\u8868\u8fbe\u5f0f\u5e94\u7528\u975e\u5e38\u5e7f\u6cdb\uff0c\u5b58\u5728\u4e8e\u5404\u79cd\u7f16\u7a0b\u8bed\u8a00\u4e2d<\/li>\n<li>2.\u6b63\u5219\u8868\u8fbe\u5f0f\u548c<code>linux<\/code>\u7684\u901a\u914d\u7b26\u4ee5\u53ca\u7279\u6b8a\u5b57\u7b26\u662f\u6709\u533a\u522b\u7684<\/li>\n<li>3.\u60f3\u8981\u5b66\u597d<code>grep\u3001sed\u3001awk<\/code>\u9996\u5148\u5c31\u9700\u8981\u5bf9\u6b63\u5219\u8868\u8fbe\u5f0f\u6709\u4e00\u5b9a\u7684\u4e86\u89e3\u3002\u53ea\u6709\u4e86\u89e3\u4e86\u89c4\u5219\uff0c\u624d\u80fd\u7075\u6d3b\u7684\u8fd0\u7528\u3002<\/li>\n<\/ul>\n<h4>\u6b63\u5219\u8868\u8fbe\u5f0f\u89c4\u5219\u8bed\u6cd5<\/h4>\n<ul>\n<li>\n<p>\u6b63\u5219\u8868\u8fbe\u5f0f\uff1a<\/p>\n<ul>\n<li><code>\\<\/code>\uff1a\u8f6c\u4e49\u7b26\uff0c\u5c06\u7279\u6b8a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u5ffd\u7565\u5176\u7279\u6b8a\u610f\u4e49<\/li>\n<li><code>^<\/code>\uff1a\u5339\u914d\u884c\u9996\uff0c\u5339\u914d\u5b57\u7b26\u4e32\u7684\u5f00\u59cb<\/li>\n<li><code> $<\/code>\uff1a\u5339\u914d\u884c\u5c3e\uff0c\u5339\u914d\u5b57\u7b26\u4e32\u7684\u7ed3\u5c3e<\/li>\n<li><code> ^$<\/code>\uff1a\u8868\u793a\u7a7a\u884c<\/li>\n<li><code>.<\/code>\uff1a\u5339\u914d\u9664\u6362\u884c\u7b26<code>\\n<\/code>\u4e4b\u5916\u7684\u4efb\u610f\u5355\u4e2a\u5b57\u7b26<\/li>\n<li><code>[]<\/code>\uff1a\u5339\u914d\u5305\u542b\u5728<code>[\u5b57\u7b26]<\/code>\u4e4b\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u5b57\u7b26<code>[a|b]cd<\/code><\/li>\n<li><code>[^]<\/code>\uff1a\u5339\u914d<code>[^a]<\/code>\u4e4b\u5916\u7684\u4efb\u610f\u5b57\u7b26<\/li>\n<li><code>[ - ]<\/code>\uff1a\u5339\u914d<code>[]<\/code>\u4e2d\u6307\u5b9a\u8303\u56f4\u5185\u7684\u4efb\u610f\u4e00\u4e2a\u5b57\u7b26<code>[a-z][0-9]<\/code><\/li>\n<li><code>?<\/code>\uff1a\u5339\u914d\u4e4b\u524d\u7684\u98791\u6b21\u6216\u80050\u6b21<\/li>\n<li><code>+<\/code>\uff1a\u5339\u914d\u4e4b\u524d\u7684\u98791\u6b21\u6216\u8005\u591a\u6b21<code>[0-9]+<\/code><\/li>\n<li><code>*<\/code>\uff1a\u5339\u914d\u4e4b\u524d\u7684\u98790\u6b21\u6216\u8005\u591a\u6b21<code>.*<\/code><\/li>\n<li><code>()<\/code>\uff1a\u5339\u914d\u8868\u8fbe\u5f0f\uff0c\u521b\u5efa\u4e00\u4e2a\u7528\u6237\u5339\u914d\u7684\u5b50\u4e32<code>grep &quot;ab(c|d)&quot;<\/code><\/li>\n<li><code>{n}<\/code>\uff1a\u5339\u914d\u4e4b\u524d\u7684\u9879<code>n<\/code>\u6b21\uff0c<code>n<\/code>\u53ef\u4ee5\u4e3a0\u7684\u6b63\u6574\u6570<code>grep &quot;[0-9]{1,3}&quot;<\/code><\/li>\n<li><code>{n,}<\/code>\uff1a\u4e4b\u524d\u7684\u9879\u81f3\u5c11\u9700\u8981\u5339\u914d<code>n<\/code>\u6b21<\/li>\n<li><code>{n,m}<\/code>\uff1a\u4e4b\u524d\u7684\u9879\u81f3\u5c11\u5339\u914d<code>n<\/code>\u6b21\uff0c\u6700\u591a\u5339\u914d<code>m<\/code>\u6b21\uff0c<code>n&lt;=m<\/code><\/li>\n<li><code>|<\/code>\uff1a\u4ea4\u66ff\u5339\u914d\uff0c<code>|<\/code>\u4e24\u8fb9\u7684\u4efb\u610f\u4e00\u9879\u5339\u914d<code>ab(c|d)<\/code><\/li>\n<li><code>\\&lt;\\&gt;<\/code>\uff1a\u951a\u5b9a\u8bcd\u9996\u4e0e\u8bcd\u5c3e\uff0c<code>\\&lt;grep\\&gt;<\/code>\uff0c\u5339\u914d\u6240\u6709\u5305\u542b<code>grep<\/code>\u5b57\u7b26\u7684\u884c\uff0c\u5982\u679c\u51fa\u73b0<code>grepa<\/code>\u662f\u4e0d\u4f1a\u88ab\u5339\u914d<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u7279\u6b8a\u5b57\u7b26\uff1a<\/p>\n<ul>\n<li><code>[[:space:]]<\/code>\uff1a\u5339\u914d\u7a7a\u683c<\/li>\n<li><code>[[:digit:]]<\/code>\uff1a\u5339\u914d<code>[0-9]<\/code><\/li>\n<li><code>[[:lower:]]<\/code>\uff1a\u5339\u914d<code>[a-z]<\/code><\/li>\n<li><code>[[:upper:]]<\/code>\uff1a\u5339\u914d<code>[A-Z]<\/code><\/li>\n<li><code>[[:alpha:]]<\/code>\uff1a\u5339\u914d<code>[a-Z]<\/code><\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u51c6\u5907\u5982\u4e0b\u6587\u4ef6\uff0c\u7136\u540e\u8fdb\u884c\u6b63\u5219\u8868\u8fbe\u5f0f\u89c4\u5219\u9a8c\u8bc1<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">I am a teacher!\nI teach linux .\ntest\n\nI like badminton ball ,billiard ball and chinese chess!\nmy blog is\nhttp:\/\/blue.yn.cn\nour site is http:\/\/blue.yn.cn\nmy qq num is 572891887 .\nnot 572891888887 .\n<\/code><\/pre>\n<ul>\n<li>\u8fdb\u884c\u5982\u4e0b\u573a\u666f\u9a8c\u8bc1\uff1a\n<ul>\n<li>1.\u8fc7\u6ee4\u4ee5<code>m<\/code>\u5f00\u5934\u7684\u884c\n<pre><code class=\"language-bash\">grep &#039;^m&#039; grep.txt\nmy blog is\nmy qq num is 572891887 .<\/code><\/pre>\n<\/li>\n<li>2.\u6392\u9664\u7a7a\u884c\uff0c\u5e76\u6253\u5370\u884c\u53f7\n<pre><code class=\"language-bash\">grep -vn &#039;^$&#039; grep.txt\n1:I am a teacher!\n2:I teach linux .\n3:test\n5:I like badminton ball ,billiard ball and chinese chess!\n6:my blog is\n7:http:\/\/blue.yn.cn\n8:our site is http:\/\/blue.yn.cn\n9:my qq num is 572891887 .\n10:not 572891888887 .<\/code><\/pre>\n<\/li>\n<li>3.\u5339\u914d\u4efb\u610f\u4e00\u4e2a\u5b57\u7b26\uff0c\u4e0d\u5305\u62ec\u7a7a\u884c\n<pre><code class=\"language-bash\">grep  &#039;.&#039; grep.txt\nI am a teacher!\nI teach linux .\ntest\nI like badminton ball ,billiard ball and chinese chess!\nmy blog is\nhttp:\/\/blue.yn.cn\nour site is http:\/\/blue.yn.cn\nmy qq num is 572891887 .\nnot 572891888887 .<\/code><\/pre>\n<\/li>\n<li>4.\u5339\u914d\u6240\u6709\u5185\u5bb9\n<pre><code class=\"language-bash\">grep  -n &#039;.*&#039; grep.txt\n[root@manager grep]# grep -n &#039;.*&#039; grep.txt\n1:I am a teacher!\n2:I teach linux .\n3:test\n4:\n5:I like badminton ball ,billiard ball and chinese chess!\n6:my blog is\n7:http:\/\/blue.yn.cn\n8:our site is http:\/\/blue.yn.cn\n9:my qq num is 572891887 .\n10:not 572891888887 .\n11:<\/code><\/pre>\n<\/li>\n<li>5.\u5339\u914d\u4ee5\u70b9\u7ed3\u5c3e\u7684\n<pre><code class=\"language-bash\">grep &#039;\\.$&#039; grep.txt\nI teach inux .\nmy qq num is 572891887 .\nnot 572891888887 .<\/code><\/pre>\n<\/li>\n<li>6.\u5339\u914d\u6709<code>a<\/code>\u6216<code>b<\/code>\u6216<code>c<\/code>\u7684\u884c\n<pre><code class=\"language-bash\">grep &#039;[a|b|c]&#039; grep.txt\nI am a teacher!\nI teach linux .\nI like badminton ball ,billiard ball and chinese chess!\nmy blog is\nhttp:\/\/blue.yn.cn\nour site is http:\/\/blue.yn.cn<\/code><\/pre>\n<\/li>\n<li>7.\u5339\u914d\u6570\u5b57\u6240\u5728\u7684\u884c\n<pre><code class=\"language-bash\">egrep &#039;[0-9]+&#039; grep.txt\nmy qq num is 572891887 .\nnot 572891888887 .<\/code><\/pre>\n<\/li>\n<li>8.\u5339\u914d\u6240\u6709\u5c0f\u5199\u5b57\u6bcd\u6240\u5728\u7684\u884c\n<pre><code class=\"language-bash\">grep &#039;[a-z]&#039; grep.txt\nI am a teacher!\nI teach linux .\ntest\nI like badminton ball ,billiard ball and chinese chess!\nmy blog is\nhttp:\/\/blue.yn.cn\nour site is http:\/\/blue.yn.cn\nmy qq num is 572891887 .\nnot 572891888887 .<\/code><\/pre>\n<\/li>\n<li>9.\u5339\u914d\u5305\u542b5\u4e2a8\u7684\u884c\n<pre><code class=\"language-bash\">egrep &#039;[8]{5}&#039; grep.txt\nnot 572891888887 .<\/code><\/pre>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u6b63\u5219\u8868\u8fbe\u5f0f\u6848\u4f8b<\/h3>\n<h4>\u8fc7\u6ee4\u6389\u7a7a\u884c\u4e0e#\u5f00\u5934\u7684\u884c<\/h4>\n<ul>\n<li>\u9700\u6c42\uff1a\u4f7f\u7528<code>grep<\/code>\u6b63\u5219\u8868\u8fbe\u5f0f\u65b9\u5f0f\uff0c\u6392\u9664<code>nginx<\/code>\u914d\u7f6e\u6587\u4ef6\u7684\u4ee5\u4e00\u4e2a\u6216\u591a\u4e2a\u7a7a\u683c+#\u5f00\u59cb\u7684\u884c\uff0c\u4ee5#\u5f00\u59cb\u7684\u884c\uff0c\u548c\u7a7a\u884c<\/li>\n<\/ul>\n<p><code>egrep -v &quot;[[:space:]]+#|^#|^$&quot; \/etc\/nginx\/nginx.conf<\/code><\/p>\n<h4>\u63d0\u53d6\u670d\u52a1\u5668\u7f51\u5361\u5730\u5740<\/h4>\n<ul>\n<li>\u9700\u6c42\uff1a\u4f7f\u7528<code>grep<\/code>\u6b63\u5219\u8868\u8fbe\u5f0f\u65b9\u5f0f\uff0c\u63d0\u53d6\u670d\u52a1\u5668<code>eth0<\/code>\u7f51\u5361\u914d\u7f6e\u7684<code>ip<\/code>\u5730\u5740<\/li>\n<\/ul>\n<p><code>ifconfig eth0 | grep &#039;inet &#039; | egrep -o &#039;[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}&#039; | head -1<\/code><\/p>\n<h4>\u5339\u914d\u65e5\u5fd7\u4e2dhttp\u7248\u672c<\/h4>\n<ul>\n<li>\u9700\u6c42\uff1a\u4f7f\u7528<code>grep<\/code>\u6b63\u5219\u8868\u8fbe\u5f0f\u65b9\u5f0f\uff0c\u5339\u914d<code>nginx<\/code>\u65e5\u5fd7\u4e2d\u7684<code>http3.0 http3.1 http2.1 http2.0 http1.1 http1.0<\/code><\/li>\n<\/ul>\n<p><code> egrep -o  &quot;HTTP\/(1|2|3)\\.(0|1)&quot; \/var\/log\/nginx\/access.log | sort | uniq -c<\/code><\/p>\n<h4>\u8fc7\u6ee4\u6389\u6ce8\u91ca\u7684\u914d\u7f6e\u6587\u4ef6<\/h4>\n<ul>\n<li>\u9700\u6c42\uff1a\u4f7f\u7528<code>grep<\/code>\u6b63\u5219\u8868\u8fbe\u5f0f\u65b9\u5f0f\uff0c\u5339\u914d<code>zabbix_agent2.conf<\/code>\u914d\u7f6e\u6587\u4ef6\u4e2d\u7d20\u6709\u5df2\u542f\u7528\u7684\u914d\u7f6e<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">egrep -v &quot;^#|^$&quot; \/etc\/zabbix\/zabbix_agent2.conf\negrep &quot;^[a-Z]&quot; \/etc\/zabbix\/zabbix_agent2.conf<\/code><\/pre>\n<h4>\u5339\u914d\u7528\u6237\u624b\u673a\u53f7\u662f\u5426\u5408\u6cd5<\/h4>\n<ul>\n<li>\u9700\u6c42\uff1a\u4f7f\u7528<code>grep<\/code>\u6b63\u5219\u8868\u8fbe\u5f0f\u65b9\u5f0f\uff0c\u5339\u914d133\u3001153\u3001189\u3001199\u5f00\u5934\u7684\u624b\u673a\u53f7\u7801<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">cat phone.sh\n#!\/usr\/bin\/bash\n\nread -p &quot;\u8bf7\u8f93\u5165\u4f60\u7684\u624b\u673a\u53f7\u7801\u4ee5 [ 133 | 153 | 189 | 199 ] \u5f00\u5934\uff1a&quot; Action\n\nif [[ $Action =~ ^[0-9]{11} ]];then\n        if [[ $Action =~ ^(133|153|189|199)[0-9]{8}$ ]];then\n                echo &quot;$Action \u624b\u673a\u53f7\u901a\u8fc7&quot;\n        else\n                echo &quot;$Action \u624b\u673a\u53f7\u4e0d\u662f\u7535\u4fe1\u624b\u673a\u53f7...&quot;\n        fi\nelse\n        echo &quot;\u4f60\u7684\u624b\u673a\u53f7\u662f ${#Action} \u4f4d\uff0c\u4e0d\u6ee1\u8db3\u8981\u6c42...&quot;\nfi<\/code><\/pre>\n<h4>\u5339\u914d\u7528\u6237\u90ae\u7bb1\u662f\u5426\u5408\u6cd5<\/h4>\n<ul>\n<li>\u9700\u6c42\uff1a\u4f7f\u7528<code>grep<\/code>\u6b63\u5219\u8868\u8fbe\u5f0f\u65b9\u5f0f\uff0c\u5339\u914d<code>qq\u3001163\u3001sina<\/code>\u7684<code>email<\/code>\u5730\u5740<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">cat email.sh\n#!\/usr\/bin\/bash\n\nread -p &quot;\u8bf7\u8f93\u5165\u627e\u56de\u5bc6\u7801\u7684\u90ae\u7bb1\uff1a&quot; Action\n\nAction_pre=${Action%@*}\n\nif [ ${#Action_pre} -gt 16 ];then\n        echo &quot;\u4f60\u8f93\u5165\u7684\u90ae\u7bb1\u524d\u7f00\u957f\u5ea6\u8d85\u8fc716\u4f4d&quot;\n        exit\nfi\n\nif [[ $Action =~ ^([0-9]|[a-Z])+@(qq|163|sina)\\..+$ ]];then\n        echo &quot;$Action \u90ae\u4ef6\u5df2\u7ecf\u53d1\u9001\uff0c\u8bf7\u767b\u5f55\u90ae\u7bb1\u70b9\u51fb\u94fe\u63a5\u627e\u56de\u5bc6\u7801&quot;\nelse\n        echo &quot;$Action \u4e0d\u7b26\u5408\u7cfb\u7edf\u9884\u5b9a\u7684\u90ae\u7bb1\u89c4\u5219\uff0c\u8bf7\u91cd\u65b0\u5c1d\u8bd5&quot;\nfi<\/code><\/pre>\n<h4>\u5339\u914d\u6587\u4ef6\u4e2d\u7684\u57df\u540d<\/h4>\n<pre><code class=\"language-bash\">cat rege.txt\nxxt-demo.shop.oldxu.com\nxxt-demoadmin.shop.oldxu.com\nabc.shop.oldxu.com\nabcadmin.shop.oldxu.com\n123.shop.oldxu.com\nabc123.shop.oldxu.com\nadmin123.shop.oldxu.com\n\negrep &quot;^([a-z]+-[a-z]+|[a-z]+|admin123)\\.shop.oldxu.com&quot; rege.txt<\/code><\/pre>\n<h3>sed\u6587\u672c\u5904\u7406<\/h3>\n<h4>sed\u57fa\u672c\u4ecb\u7ecd<\/h4>\n<ul>\n<li><code>sed(stream editor)<\/code>\u6d41\u7f16\u8f91\u5668\uff0c\u80fd\u591f\u5bf9\u6807\u51c6\u8f93\u51fa\u6216\u6587\u4ef6\u8fdb\u884c\u9010\u884c\u5904\u7406<br \/>\n\u7b80\u5355\u6765\u8bf4\uff0c<code>sed<\/code>\u53ef\u4ee5\u5b9e\u73b0\u5bf9\u6587\u4ef6\u7684\u589e\u3001\u5220\u3001\u67e5\u3001\u6539<\/li>\n<\/ul>\n<h4>sed\u5de5\u4f5c\u6a21\u5f0f<\/h4>\n<p><code>sed<\/code>\u8bfb\u53d6\u6587\u4ef6\u4e00\u884c\uff0c\u5b58\u653e\u5728\u7f13\u5b58\u533a\uff0c\u7136\u540e\u5904\u7406\uff0c\u6700\u540e\u8f93\u51fa<\/p>\n<h4>sed\u57fa\u7840\u8bed\u6cd5<\/h4>\n<ul>\n<li>\u7b2c\u4e00\u79cd\u5f62\u5f0f\uff1a<code>stdout | sed [option] &quot;pattern command&quot;<\/code><\/li>\n<li>\u7b2c\u4e8c\u79cd\u5f62\u5f0f\uff1a<code>sed [option] &quot;pattern command&quot; file<\/code><\/li>\n<\/ul>\n<h4>sed\u5e38\u7528\u9009\u9879<\/h4>\n<table>\n<thead>\n<tr>\n<th>\u9009\u9879<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>-n<\/td>\n<td>\u53ea\u6253\u5370\u5339\u914d\u7684\u884c\uff08\u53d6\u6d88\u6587\u4ef6\u7684\u9ed8\u8ba4\u8f93\u51fa\uff09<\/td>\n<\/tr>\n<tr>\n<td>-e<\/td>\n<td>\u5141\u8bb8\u591a\u9879\u7f16\u8f91<\/td>\n<\/tr>\n<tr>\n<td>-f<\/td>\n<td>\u7f16\u8f91\u52a8\u4f5c\u4fdd\u5b58\u5728\u6587\u4ef6\uff0c\u6307\u5b9a\u6587\u4ef6\u624d\u6267\u884c<\/td>\n<\/tr>\n<tr>\n<td>-r<\/td>\n<td>\u652f\u6301\u6269\u5c55\u6b63\u5219\u8868\u8fbe\u5f0f<\/td>\n<\/tr>\n<tr>\n<td>-i<\/td>\n<td>\u76f4\u63a5\u53d8\u66f4\u6587\u4ef6\u5185\u5bb9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>-n\u9009\u9879<\/h5>\n<ul>\n<li><code>sed -n<\/code>\u7528\u4e8e\u53d6\u6d88\u9ed8\u8ba4\u8f93\u51fa<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">sed -n &#039;\/^root\/p&#039; \/etc\/passwd\nroot:x:0:0:root:\/root:\/bin\/bash<\/code><\/pre>\n<h5>-e\u9009\u9879<\/h5>\n<ul>\n<li><code>sed -e<\/code>\u7528\u4e8e\u591a\u9879\u7f16\u8f91<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">sed -n -e &#039;\/^root\/p&#039; -e &#039;\/^chrony\/p&#039; \/etc\/passwd\nroot:x:0:0:root:\/root:\/bin\/bash\nchrony:x:998:996::\/var\/lib\/chrony:\/sbin\/nologin\n\nsed -n -r &#039;\/^root|^chrony\/p&#039;  \/etc\/passwd\nroot:x:0:0:root:\/root:\/bin\/bash\nchrony:x:998:996::\/var\/lib\/chrony:\/sbin\/nologin<\/code><\/pre>\n<h5>-f\u9009\u9879<\/h5>\n<ul>\n<li><code>sed -f<\/code>\u7f16\u8f91\u52a8\u4f5c\u4fdd\u5b58\u5728\u6587\u4ef6\uff0c\u6307\u5b9a\u6587\u4ef6\u624d\u6267\u884c<\/li>\n<\/ul>\n<p>\u5c06<code>pattern<\/code>\u5199\u5165\u6587\u4ef6\u4e2d<\/p>\n<pre><code class=\"language-bash\">cat edit.sed\n\/^root|^chrony\/p<\/code><\/pre>\n<p>\u901a\u8fc7<code>sed -f<\/code>\u6267\u884c<\/p>\n<pre><code class=\"language-bash\">sed -nrf edit.sed \/etc\/passwd\nroot:x:0:0:root:\/root:\/bin\/bash\nchrony:x:998:996::\/var\/lib\/chrony:\/sbin\/nologin<\/code><\/pre>\n<h5>-r\u9009\u9879<\/h5>\n<ul>\n<li><code>sed -r<\/code>\u652f\u6301\u6269\u5c55\u6b63\u5219\u8868\u8fbe\u5f0f<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">ifconfig eth0 | sed -n &#039;\/inet \/p&#039; | sed -r &#039;s#(^.*et) (.*) (net.*$)#\\2#g&#039;\n192.168.99.7<\/code><\/pre>\n<h4>sed pattern\u8fc7\u6ee4<\/h4>\n<ul>\n<li>\u547d\u4ee4\u683c\u5f0f\uff1a<code>sed [option] &#039;\/pattern\/command&#039; file<\/code><\/li>\n<\/ul>\n<h5>pattern\u547d\u4ee4\u683c\u5f0f<\/h5>\n<table>\n<thead>\n<tr>\n<th>\u5339\u914d\u6a21\u5f0f<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>10command<\/td>\n<td>\u5339\u914d\u7b2c10\u884c<\/td>\n<\/tr>\n<tr>\n<td>10,20command<\/td>\n<td>\u5339\u914d\u4ece\u7b2c10\u884c\u5f00\u59cb\uff0c\u5230\u7b2c20\u884c\u7ed3\u675f<\/td>\n<\/tr>\n<tr>\n<td>10,+5command<\/td>\n<td>\u5339\u914d\u4ece\u7b2c10\u884c\u5f00\u59cb\uff0c\u5230\u7b2c15\u884c\u7ed3\u675f<\/td>\n<\/tr>\n<tr>\n<td>\/pattern1\/,\/pattern2\/command<\/td>\n<td>\u5339\u914d\u5230pattern1\u7684\u884c\u5f00\u59cb\uff0c\u5230\u5339\u914d\u5230pattern2\u7684\u884c\u7ed3\u675f<\/td>\n<\/tr>\n<tr>\n<td>10,\/pattern1\/command<\/td>\n<td>\u5339\u914d\u4ece\u7b2c10\u884c\u5f00\u59cb\uff0c\u5230\u5339\u914d\u5230pattern1\u7684\u884c\u7ed3\u675f<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>pattern\u547d\u4ee4\u793a\u4f8b<\/h5>\n<ul>\n<li>\n<p>\u793a\u4f8b1\uff1a\u6307\u5b9a\u884c\u53f7<\/p>\n<pre><code class=\"language-bash\"># \u6253\u5370passwd\u6587\u4ef6\u7684\u7b2c10\u884c\nsed -n &#039;10p&#039; \/etc\/passwd\noperator:x:11:0:operator:\/root:\/sbin\/nologin<\/code><\/pre>\n<\/li>\n<li>\n<p>\u793a\u4f8b2\uff1a\u6307\u5b9a\u8d77\u59cb\u884c\u53f7\u548c\u7ed3\u675f\u884c\u53f7<\/p>\n<pre><code class=\"language-bash\"># \u6253\u5370passwd\u6587\u4ef6\u768410\u523020\u884c\nsed -n &#039;10,20p&#039; \/etc\/passwd<\/code><\/pre>\n<\/li>\n<li>\n<p>\u793a\u4f8b3\uff1a\u6307\u5b9a\u8d77\u59cb\u884c\u53f7\uff0c\u7136\u540e\u52a0<code>N<\/code>\u884c<\/p>\n<pre><code class=\"language-bash\"># \u6253\u5370passwd\u6587\u4ef6\u4e2d\u4ece\u7b2c1\u884c\u5f00\u59cb\uff0c\u5f80\u540e\u9762\u52a05\u884c\u7684\u5185\u5bb9\nsed -n &#039;1,+5p&#039; \/etc\/passwd<\/code><\/pre>\n<\/li>\n<li>\n<p>\u793a\u4f8b4\uff1a\u6b63\u5219\u8868\u8fbe\u5f0f\u5339\u914d\uff08\u6253\u5370<code>passwd<\/code>\u6587\u4ef6\u4e2d\u4ee5<code>root<\/code>\u5f00\u5934\u7684\u884c\uff09<\/p>\n<pre><code class=\"language-bash\">sed -n &#039;\/^root\/p&#039; \/etc\/passwd\nroot:x:0:0:root:\/root:\/bin\/bash<\/code><\/pre>\n<\/li>\n<li>\n<p>\u793a\u4f8b5\uff1a\u4ece\u5339\u914d\u5230<code>pattern1<\/code>\u7684\u884c\uff0c\u5230\u5339\u914d<code>pattern2<\/code>\u7684\u884c\uff08\u6253\u5370<code>passwd<\/code>\u6587\u4ef6\u7b2c\u4e00\u4e2a\u5339\u914d\u5230\u4ee5<code>bin<\/code>\u5f00\u5934\u7684\u884c\uff0c\u5230\u7b2c\u4e8c\u4e2a\u5339\u914d\u5230\u4ee5<code>ftp<\/code>\u5f00\u5934\u7684\u884c<br \/>\n<code>sed -n &#039;\/^bin\/,\/^ftp\/p&#039; \/etc\/passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b6\uff1a\u4ece\u6307\u5b9a\u7684\u884c\u53f7\u5f00\u59cb\u5339\u914d\uff0c\u76f4\u5230\u5339\u914d\u5230<code>pattern1<\/code>\u7684\u884c<\/p>\n<pre><code class=\"language-bash\"># \u6253\u5370passwd\u6587\u4ef6\u4e2d\u4ece\u7b2c2\u884c\u5f00\u59cb\u5339\u914d\uff0c\u76f4\u5230\u4ee5sync\u5f00\u5934\u7684\u884c\u7ed3\u675f\nsed -n &#039;2,\/^sync\/p&#039; \/etc\/passwd\nbin:x:1:1:bin:\/bin:\/sbin\/nologin\ndaemon:x:2:2:daemon:\/sbin:\/sbin\/nologin\nadm:x:3:4:adm:\/var\/adm:\/sbin\/nologin\nlp:x:4:7:lp:\/var\/spool\/lpd:\/sbin\/nologin\nsync:x:5:0:sync:\/sbin:\/bin\/sync<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>sed\u8ffd\u52a0\u547d\u4ee4<\/h4>\n<h5>\u8ffd\u52a0\u547d\u4ee4\u683c\u5f0f<\/h5>\n<table>\n<thead>\n<tr>\n<th>\u7f16\u8f91\u547d\u4ee4<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>a<\/td>\n<td>\u884c\u540e\u9762\u8ffd\u52a0\u5185\u5bb9append<\/td>\n<\/tr>\n<tr>\n<td>i<\/td>\n<td>\u884c\u524d\u8ffd\u52a0\u5185\u5bb9insert<\/td>\n<\/tr>\n<tr>\n<td>r<\/td>\n<td>\u8bfb\u5165\u5916\u90e8\u6587\u4ef6\uff0c\u884c\u540e\u8ffd\u52a0<\/td>\n<\/tr>\n<tr>\n<td>w<\/td>\n<td>\u5c06\u5339\u914d\u884c\u5199\u5165\u5916\u90e8\u6587\u4ef6<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul>\n<li>\n<p>\u793a\u4f8b1\uff1a\u5339\u914d<code>\/bin<\/code>\u5f00\u59cb\u7684\u884c\uff0c\u5728\u5176\u540e\u9762\u6dfb\u52a0\u5185\u5bb9<br \/>\n<code>sed -i &#039;\/^bin\/a OKOK\\nKOKO&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b2\uff1a\u4ee5<code>\/nobody<\/code>\u5f00\u5934\u7684\u884c\u5230\u4ee5<code>sshd<\/code>\u5f00\u5934\u7684\u884c\uff0c\u524d\u9762\u6dfb\u52a0\u5185\u5bb9<br \/>\n<code>sed -i &#039;\/^nobody\/,\/^sshd\/i OK-AAA-OK&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b3\uff1a\u66f4\u6539<code>ssh<\/code>\u7aef\u53e3<br \/>\n<code>sed -i &#039;\/#Port\/i Port 666&#039; \/etc\/ssh\/sshd_config<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b4\uff1a\u7ed9\u6587\u4ef6\u7684\u7b2c6\u884c\u524d\u9762\u6dfb\u52a0\u5185\u5bb9<br \/>\n<code>sed -i &#039;6i hello world&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b5\uff1a\u5c06<code>edit.sed<\/code>\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff0c\u8ffd\u52a0\u5230\u5339\u914d\u6a21\u5f0f\u7684\u884c\u540e\u9762<br \/>\n<code>sed -i &#039;\/^root\/r edit.sed&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b6\uff1a\u5339\u914d<code>\/bin\/bash<\/code>\u6240\u6709\u7684\u884c\uff0c\u5c06\u5176\u4fdd\u5b58\u81f3<code>login.txt<\/code>\u6587\u4ef6\u4e2d<\/p>\n<pre><code class=\"language-bash\">sed -n &#039;\/\\\/bin\\\/bash\/w login.txt&#039; passwd\ncat login.txt\nroot:x:0:0:root:\/root:\/bin\/bash\nwww:x:666:666::\/home\/www:\/bin\/bash<\/code><\/pre>\n<\/li>\n<li>\n<p>\u793a\u4f8b7\uff1a<code>passwd<\/code>\u6587\u4ef6\u6bcf\u4e00\u884c\u524d\u9762\u90fd\u8ffd\u52a0<code>hello world<\/code><br \/>\n<code>sed -i &#039;\/^\/i hello world&#039; passwd<\/code><\/p>\n<\/li>\n<\/ul>\n<h4>sed\u5220\u9664\u547d\u4ee4<\/h4>\n<h5>\u5220\u9664\u547d\u4ee4\u683c\u5f0f<\/h5>\n<table>\n<thead>\n<tr>\n<th>\u7f16\u8f91\u547d\u4ee4<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1d<\/td>\n<td>\u5220\u9664\u7b2c1\u884c\u7684\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>1,5d<\/td>\n<td>\u5220\u9664\u7b2c1\u884c\u5230\u7b2c5\u884c\u7684\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>2,+5d<\/td>\n<td>\u5220\u9664\u7b2c2\u884c\u4ee5\u53ca\u5f80\u4e0b5\u884c\u7684\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>\/pattern1\/d<\/td>\n<td>\u5220\u9664\u6bcf\u884c\u4e2d\u5339\u914d\u5230pattern1\u7684\u884c\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>\/pattern1\/,\/pattern2\/d<\/td>\n<td>\u5220\u9664\u5339\u914dpattern1\u7684\u884c\u76f4\u5230\u5339\u914d\u5230pattern2\u7684\u884c\u7684\u6240\u6709\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>\/pattern1\/,10d<\/td>\n<td>\u5220\u9664\u5339\u914dpattern1\u7684\u884c\u5230\u7b2c10\u884c\u7684\u6240\u6709\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>10,\/pattern1\/d<\/td>\n<td>\u5220\u9664\u7b2c10\u884c\u76f4\u5230\u5339\u914d\u5230pattern1\u7684\u6240\u6709\u5185\u5bb9<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>\u5220\u9664\u547d\u4ee4\u793a\u4f8b<\/h5>\n<ul>\n<li>\n<p>\u793a\u4f8b1\uff1a\u5220\u9664<code>passwd<\/code>\u6587\u4ef6\u4e2d\u7b2c1\u884c\u7684\u5185\u5bb9<br \/>\n<code>sed -i &#039;1d&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b2\uff1a\u5220\u9664<code>passwd<\/code>\u6587\u4ef6\u4e2d\u7b2c1\u884c\u5230\u7b2c5\u884c\u7684\u5185\u5bb9<br \/>\n<code>sed -i &#039;1,5d passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b3\uff1a\u5220\u9664<code>passwd<\/code>\u6587\u4ef6\u4e2d\u7b2c2\u884c\u4ee5\u53ca\u5f80\u4e0b5\u884c\u7684\u5185\u5bb9<br \/>\n<code>sed -i &#039;2,+5d passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b4\uff1a\u5339\u914d<code>\/sbin\/nologin<\/code>\u7ed3\u5c3e\u7684\u884c\uff0c\u7136\u540e\u8fdb\u884c\u5220\u9664<br \/>\n<code>sed -i &#039;\/\\\/sbin\\\/nologin$\/d&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b5\uff1a\u5220\u9664\u5339\u914d\u4ee5<code>sshd<\/code>\u5f00\u5934\u7684\u884c\uff0c\u5230<code>rpc<\/code>\u5f00\u5934\u7684\u884c<br \/>\n<code>sed -i &#039;\/^sshd\/,\/^rpc\/d&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b6\uff1a\u627e\u5230\u914d\u7f6e\u6587\u4ef6\u4e2d\u6ce8\u91ca\u7684\u884c\u4ee5\u53ca\u7a7a\u884c<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-bash\">1.\u4ee5#\u53f7\u5f00\u5934\u7684\u884c\nsed -n &#039;\/^#\/p&#039; test.txt\n# nihao\n####nihao<\/code><\/pre>\n<pre><code class=\"language-bash\">2.\u4ee5\u7a7a\u683c+#\u53f7\u6216\u8005#\u5f00\u5934\u7684\u884c\nsed -rn &#039;\/^ *#\/p&#039; test.txt\n    #hello o\n# nihao\n####nihao\n         ####<\/code><\/pre>\n<pre><code class=\"language-bash\">3.\u7a7a\u884c\nsed -n &#039;\/^$\/p&#039; test.txt\n<\/code><\/pre>\n<pre><code class=\"language-bash\">4.\u4ee5tab\u952e\u6216\u7a7a\u683c\u5f00\u5934+#\u5f00\u5934\u7684\u884c\nsed -n &#039;\/^[ |\\t]*#\/p&#039; test.txt\n    #hello o\n# nihao\n####nihao\n         ####\n                #if\n        #else<\/code><\/pre>\n<pre><code class=\"language-bash\">5.\u6700\u540e\u5408\u6210\u4e00\u53e5\u5220\u6389\u6ce8\u91ca\u7684\u884c\nsed -r &#039;\/^[ |\\t]*#|^$\/d&#039; test.txt\nsed -ri &#039;\/^[ \\t]*#|^$\/d&#039; test.txt\n123\nabc<\/code><\/pre>\n<h4>sed\u4fee\u6539\u547d\u4ee4<\/h4>\n<h5>\u4fee\u6539\u547d\u4ee4\u683c\u5f0f<\/h5>\n<table>\n<thead>\n<tr>\n<th>\u7f16\u8f91\u547d\u4ee4<\/th>\n<th>\u542b\u4e49<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1s\/old\/new\/<\/td>\n<td>\u66ff\u6362\u7b2c1\u884c\u5185\u5bb9old\u4e3anew<\/td>\n<\/tr>\n<tr>\n<td>1,10s\/old\/new\/<\/td>\n<td>\u66ff\u6362\u7b2c1\u884c\u5230\u7b2c10\u884c\u7684\u5185\u5bb9old\u4e3anew<\/td>\n<\/tr>\n<tr>\n<td>1,+5s\/old\/new\/<\/td>\n<td>\u66ff\u6362\u7b2c1\u884c\u5230\u7b2c6\u884c\u7684\u5185\u5bb9old\u4e3anew<\/td>\n<\/tr>\n<tr>\n<td>\/pattern1\/s\/old\/new\/<\/td>\n<td>\u66ff\u6362\u5339\u914dpattern1\u7684\u5185\u5bb9old\u4e3anew<\/td>\n<\/tr>\n<tr>\n<td>\/pattern1\/,\/pattern2\/s\/old\/new\/<\/td>\n<td>\u66ff\u6362\u5339\u914dpattern1\u7684\u884c\u76f4\u5230\u5339\u914d\u5230pattern2\u7684\u6240\u6709\u884c\u5185\u5bb9old\u4e3anew<\/td>\n<\/tr>\n<tr>\n<td>10,\/pattern1\/s\/old\/new\/<\/td>\n<td>\u66ff\u6362\u7b2c10\u884c\u76f4\u5230\u5339\u914d\u5230pattern1\u7684\u6240\u6709\u884c\u5185\u5bb9old\u4e3anew<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5>\u4fee\u6539\u547d\u4ee4\u793a\u4f8b<\/h5>\n<ul>\n<li>\n<p>\u793a\u4f8b1\uff1a\u4f7f\u7528<code>sed<\/code>\u63d0\u53d6<code>eth0<\/code>\u7f51\u5361\u7684<code>ip<\/code>\u5730\u5740<\/p>\n<pre><code class=\"language-bash\">ifconfig eth0 | sed -rn &#039;2s#(^.*net) (.*) (net.*$)#\\2#p&#039;\n192.168.99.7\nifconfig eth0 | sed -n &#039;\/net \/p&#039; | sed -r &#039;s#(^.*net) (.*) (net.*$)#\\2#&#039;\n192.168.99.7<\/code><\/pre>\n<\/li>\n<li>\n<p>\u793a\u4f8b2\uff1a\u4fee\u6539<code>passwd<\/code>\u6587\u4ef6\u7b2c1\u884c\u4e2d\u7b2c\u4e00\u4e2a<code>root<\/code>\u4e3a<code>ROOT<\/code> \uff08g\u4e3a\u5168\u5c40\/\u5168\u90e8\u66ff\u6362\uff09<br \/>\n<code>sed -i &#039;1s\/root\/ROOT\/&#039; passwd<\/code><br \/>\n<code>sed -i &#039;1s\/root\/ROOT\/g&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b3\uff1a\u5c06<code>passwd<\/code>\u6587\u4ef6\u6240\u6709\u884c\u524d\u9762\u6dfb\u52a0\u6ce8\u91ca<br \/>\n<code>sed -n &#039;s\/^\/# \/p&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b4\uff1a\u4fee\u6539<code>passwd<\/code>\u6587\u4ef6\u4e2d\u7b2c5\u884c\u5230\u7b2c10\u884c\u4e2d\u6240\u6709\u7684<code>\/sbin\/nologin<\/code>\u4e3a<code>\/bin\/bash<\/code><br \/>\n<code>sed -n &#039;5,10s#\/sbin\/nologin#\/bin\/bash#p&#039; passwd<\/code><\/p>\n<\/li>\n<li>\n<p>\u793a\u4f8b5\uff1a\u4fee\u6539<code>SELINUX=enforce<\/code>\u4e3a<code>SELINUX=disabled<\/code>(\u53ef\u4ee5\u4f7f\u7528<code>c<\/code>\u66ff\u6362\u65b9\u5f0f)<br \/>\n<code>sed -i &#039;\/^SELINUX=\/c SELINUX=disabled&#039; \/etc\/selinux\/config<\/code><\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u6b63\u5219\u8868\u8fbe\u5f0f\u4ecb\u7ecd \u4ec0\u4e48\u662f\u6b63\u5219\u8868\u8fbe\u5f0f \u4ee5\u7279\u5b9a\u7684\u7b26\u53f7\u8868\u793a\u4e00\u7ec4\u6570\u5b57\u6216\u5b57\u6bcd\u7684\uff0c\u4e00\u79cd\u89c4\u5219\u3002 \u4e3a\u4f55\u9700\u8981\u6b63\u5219\u8868\u8fbe\u5f0f \u5728\u5de5\u4f5c\u4e2d\uff0c&#8230; &raquo; <a class=\"read-more-link\" href=\"http:\/\/blue.yn.cn\/?p=942\">\u9605\u8bfb\u5168\u6587<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[],"class_list":["post-942","post","type-post","status-publish","format-standard","hentry","category-shell"],"_links":{"self":[{"href":"http:\/\/blue.yn.cn\/index.php?rest_route=\/wp\/v2\/posts\/942","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blue.yn.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blue.yn.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blue.yn.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blue.yn.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=942"}],"version-history":[{"count":26,"href":"http:\/\/blue.yn.cn\/index.php?rest_route=\/wp\/v2\/posts\/942\/revisions"}],"predecessor-version":[{"id":1835,"href":"http:\/\/blue.yn.cn\/index.php?rest_route=\/wp\/v2\/posts\/942\/revisions\/1835"}],"wp:attachment":[{"href":"http:\/\/blue.yn.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=942"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blue.yn.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=942"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blue.yn.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=942"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}