{"id":44824,"date":"2024-10-06T18:26:15","date_gmt":"2024-10-06T10:26:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/44824\/"},"modified":"2024-10-06T18:26:15","modified_gmt":"2024-10-06T10:26:15","slug":"linux-%e5%91%bd%e4%bb%a4%ef%bc%9aseq-%e6%89%93%e5%8d%b0%e6%95%b8%e5%ad%97%e5%ba%8f%e5%88%97","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/44824\/","title":{"rendered":"Linux \u547d\u4ee4\uff1aseq &#8211; \u6253\u5370\u6578\u5b57\u5e8f\u5217"},"content":{"rendered":"<h1 id=\"linux-%e5%91%bd%e4%bb%a4%ef%bc%9aseq-%e6%89%93%e5%8d%b0%e6%95%b8%e5%ad%97%e5%ba%8f%e5%88%97-WGGrrRsCjD\">Linux \u547d\u4ee4\uff1aseq &#8211; \u6253\u5370\u6578\u5b57\u5e8f\u5217<\/h1>\n<p>\u5728 Linux \u7cfb\u7d71\u4e2d\uff0c\u547d\u4ee4\u884c\u5de5\u5177\u662f\u9032\u884c\u5404\u7a2e\u64cd\u4f5c\u7684\u91cd\u8981\u624b\u6bb5\u3002\u5176\u4e2d\uff0c<code>seq<\/code> \u547d\u4ee4\u662f\u4e00\u500b\u975e\u5e38\u5be6\u7528\u7684\u5de5\u5177\uff0c\u7528\u65bc\u751f\u6210\u6578\u5b57\u5e8f\u5217\u3002\u7121\u8ad6\u662f\u5728\u8173\u672c\u7de8\u5beb\u3001\u6578\u64da\u8655\u7406\u9084\u662f\u65e5\u5e38\u4efb\u52d9\u4e2d\uff0c<code>seq<\/code> \u90fd\u80fd\u63d0\u4f9b\u4fbf\u5229\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e <code>seq<\/code> \u547d\u4ee4\u7684\u7528\u6cd5\u53ca\u5176\u61c9\u7528\u5834\u666f\u3002<\/p>\n<h2 id=\"%e5%9f%ba%e6%9c%ac%e7%94%a8%e6%b3%95-WGGrrRsCjD\">\u57fa\u672c\u7528\u6cd5<\/h2>\n<p><code>seq<\/code> \u547d\u4ee4\u7684\u57fa\u672c\u8a9e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>seq [\u9078\u9805]... [\u6700\u5c0f\u503c [\u6700\u5927\u503c [\u6b65\u9577]]]<\/code><\/pre>\n<p>\u9019\u88e1\u7684\u53c3\u6578\u89e3\u91cb\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u6700\u5c0f\u503c<\/strong>\uff1a\u5e8f\u5217\u7684\u8d77\u59cb\u6578\u5b57\uff0c\u9ed8\u8a8d\u70ba 1\u3002<\/li>\n<li><strong>\u6700\u5927\u503c<\/strong>\uff1a\u5e8f\u5217\u7684\u7d50\u675f\u6578\u5b57\u3002<\/li>\n<li><strong>\u6b65\u9577<\/strong>\uff1a\u6578\u5b57\u4e4b\u9593\u7684\u589e\u91cf\uff0c\u9ed8\u8a8d\u70ba 1\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%a4%ba%e4%be%8b-WGGrrRsCjD\">\u793a\u4f8b<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684 <code>seq<\/code> \u547d\u4ee4\u793a\u4f8b\uff1a<\/p>\n<h3 id=\"%e7%94%9f%e6%88%90%e7%b0%a1%e5%96%ae%e7%9a%84%e6%95%b8%e5%ad%97%e5%ba%8f%e5%88%97-WGGrrRsCjD\">\u751f\u6210\u7c21\u55ae\u7684\u6578\u5b57\u5e8f\u5217<\/h3>\n<p>\u8981\u751f\u6210\u5f9e 1 \u5230 10 \u7684\u6578\u5b57\u5e8f\u5217\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>seq 10<\/code><\/pre>\n<p>\u9019\u5c07\u8f38\u51fa\uff1a<\/p>\n<pre><code>1\n2\n3\n4\n5\n6\n7\n8\n9\n10<\/code><\/pre>\n<h3 id=\"%e6%8c%87%e5%ae%9a%e6%9c%80%e5%b0%8f%e5%80%bc%e5%92%8c%e6%9c%80%e5%a4%a7%e5%80%bc-WGGrrRsCjD\">\u6307\u5b9a\u6700\u5c0f\u503c\u548c\u6700\u5927\u503c<\/h3>\n<p>\u5982\u679c\u9700\u8981\u751f\u6210\u5f9e 5 \u5230 15 \u7684\u6578\u5b57\u5e8f\u5217\uff0c\u53ef\u4ee5\u9019\u6a23\u505a\uff1a<\/p>\n<pre><code>seq 5 15<\/code><\/pre>\n<p>\u8f38\u51fa\u7d50\u679c\u70ba\uff1a<\/p>\n<pre><code>5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15<\/code><\/pre>\n<h3 id=\"%e4%bd%bf%e7%94%a8%e6%ad%a5%e9%95%b7-WGGrrRsCjD\">\u4f7f\u7528\u6b65\u9577<\/h3>\n<p>\u9664\u4e86\u6700\u5c0f\u503c\u548c\u6700\u5927\u503c\uff0c<code>seq<\/code> \u9084\u652f\u6301\u6b65\u9577\u7684\u8a2d\u7f6e\u3002\u4f8b\u5982\uff0c\u82e5\u8981\u751f\u6210\u5f9e 1 \u5230 20 \u7684\u5076\u6578\u5e8f\u5217\uff0c\u53ef\u4ee5\u4f7f\u7528\uff1a<\/p>\n<pre><code>seq 2 2 20<\/code><\/pre>\n<p>\u9019\u5c07\u8f38\u51fa\uff1a<\/p>\n<pre><code>2\n4\n6\n8\n10\n12\n14\n16\n18\n20<\/code><\/pre>\n<h2 id=\"%e9%81%b8%e9%a0%85-WGGrrRsCjD\">\u9078\u9805<\/h2>\n<p><code>seq<\/code> \u547d\u4ee4\u9084\u652f\u6301\u591a\u7a2e\u9078\u9805\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u9078\u9805\uff1a<\/p>\n<ul>\n<li><strong>-f, &#8211;format=FORMAT<\/strong>\uff1a\u6307\u5b9a\u8f38\u51fa\u683c\u5f0f\u3002\u4f8b\u5982\uff0c<code>seq -f \"%02g\" 5<\/code> \u5c07\u8f38\u51fa 01, 02, 03, 04, 05\u3002<\/li>\n<li><strong>-s, &#8211;separator=STRING<\/strong>\uff1a\u6307\u5b9a\u8f38\u51fa\u6578\u5b57\u4e4b\u9593\u7684\u5206\u9694\u7b26\u3002\u9ed8\u8a8d\u70ba\u63db\u884c\u7b26\u3002\u4f8b\u5982\uff0c<code>seq -s \", \" 5<\/code> \u5c07\u8f38\u51fa 1, 2, 3, 4, 5\u3002<\/li>\n<li><strong>-w, &#8211;equal-width<\/strong>\uff1a\u4f7f\u6240\u6709\u8f38\u51fa\u6578\u5b57\u7684\u5bec\u5ea6\u76f8\u540c\uff0c\u524d\u9762\u88dc\u96f6\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%87%89%e7%94%a8%e5%a0%b4%e6%99%af-WGGrrRsCjD\">\u61c9\u7528\u5834\u666f<\/h2>\n<p><code>seq<\/code> \u547d\u4ee4\u5728\u8a31\u591a\u5834\u666f\u4e2d\u90fd\u80fd\u767c\u63ee\u4f5c\u7528\uff0c\u4f8b\u5982\uff1a<\/p>\n<ul>\n<li>\u5728\u8173\u672c\u4e2d\u751f\u6210\u5faa\u74b0\u7684\u6578\u5b57\u5e8f\u5217\uff0c\u4fbf\u65bc\u9032\u884c\u6279\u91cf\u8655\u7406\u3002<\/li>\n<li>\u751f\u6210\u6e2c\u8a66\u6578\u64da\uff0c\u65b9\u4fbf\u9032\u884c\u6027\u80fd\u6e2c\u8a66\u6216\u6578\u64da\u5206\u6790\u3002<\/li>\n<li>\u5728\u6578\u64da\u53ef\u8996\u5316\u4e2d\uff0c\u751f\u6210\u5750\u6a19\u8ef8\u7684\u6578\u5b57\u6a19\u7c64\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-WGGrrRsCjD\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u7684\u4f86\u8aaa\uff0c<code>seq<\/code> \u547d\u4ee4\u662f\u4e00\u500b\u7c21\u55ae\u800c\u5f37\u5927\u7684\u5de5\u5177\uff0c\u80fd\u5920\u5e6b\u52a9\u7528\u6236\u5feb\u901f\u751f\u6210\u6578\u5b57\u5e8f\u5217\u3002\u7121\u8ad6\u662f\u5728\u65e5\u5e38\u7684\u7cfb\u7d71\u7ba1\u7406\u9084\u662f\u958b\u767c\u5de5\u4f5c\u4e2d\uff0c\u638c\u63e1\u9019\u500b\u547d\u4ee4\u90fd\u80fd\u63d0\u9ad8\u5de5\u4f5c\u6548\u7387\u3002\u5982\u679c\u60a8\u5c0d\u65bc\u66f4\u9ad8\u6548\u7684\u6578\u64da\u8655\u7406\u548c\u7ba1\u7406\u6709\u9700\u6c42\uff0c\u8003\u616e\u4f7f\u7528 <a href=\"https:\/\/server.hk\">\u9999\u6e2f VPS<\/a> \u670d\u52d9\u4f86\u63d0\u5347\u60a8\u7684\u5de5\u4f5c\u74b0\u5883\u3002\u7121\u8ad6\u662f\u642d\u5efa\u4f3a\u670d\u5668\u9084\u662f\u9032\u884c\u96f2\u8a08\u7b97\uff0c<a href=\"https:\/\/server.hk\">\u9999\u6e2f\u4f3a\u670d\u5668<\/a> \u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 Linux \u547d\u4ee4 seq \u6253\u5370\u6578\u5b57\u5e8f\u5217\uff0c\u8f15\u9b06\u751f\u6210\u7bc4\u570d\u5167\u7684\u6578\u5b57\uff0c\u9069\u5408\u8173\u672c\u548c\u6578\u64da\u8655\u7406\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-44824","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=44824"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44824\/revisions"}],"predecessor-version":[{"id":44825,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/44824\/revisions\/44825"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=44824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=44824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=44824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}