{"id":1054,"date":"2019-04-30T10:29:53","date_gmt":"2019-04-30T02:29:53","guid":{"rendered":"https:\/\/www.linuxcool.com\/?p=1054"},"modified":"2019-05-01T18:59:31","modified_gmt":"2019-05-01T10:59:31","slug":"csplit","status":"publish","type":"post","link":"https:\/\/www.linuxcool.com\/csplit","title":{"rendered":"csplit\u547d\u4ee4 – \u5206\u5272\u6587\u4ef6"},"content":{"rendered":"\n

csplit\u547d\u4ee4\u7684\u82f1\u6587\u5168\u79f0\u662f\u201ccontext split\u201d\uff0c\u8be5\u547d\u4ee4\u7528\u4e8e\u5c06\u4e00\u4e2a\u5927\u6587\u4ef6\u5206\u5272\u6210\u5c0f\u7684\u788e\u7247\uff0c\u5e76\u4e14\u5c06\u5206\u5272\u540e\u7684\u6bcf\u4e2a\u788e\u7247\u4fdd\u5b58\u6210\u4e00\u4e2a\u6587\u4ef6\u3002\u788e\u7247\u6587\u4ef6\u7684\u547d\u540d\u7c7b\u4f3c\u201cxx00\u201d\uff0c\u201cxx01\u201d\u3002csplit\u547d\u4ee4\u662fsplit\u7684\u4e00\u4e2a\u53d8\u4f53\uff0csplit\u53ea\u80fd\u591f\u6839\u636e\u6587\u4ef6\u5927\u5c0f\u6216\u884c\u6570\u6765\u5206\u5272\uff0c\u4f46csplit\u80fd\u591f\u6839\u636e\u6587\u4ef6\u672c\u8eab\u7279\u70b9\u6765\u5206\u5272\u6587\u4ef6\u3002 <\/p>\n\n\n\n

\u8bed\u6cd5\u53c2\u6570\uff1a<\/strong>csplit [\u53c2\u6570]<\/p>\n\n\n\n

\u5e38\u7528\u53c2\u6570\uff1a<\/strong><\/p>\n\n\n\n
-b<\u8f93\u51fa\u683c\u5f0f>\u6216--suffix-format=<\u8f93\u51fa\u683c\u5f0f> <\/td>\u9884\u8bbe\u7684\u8f93\u51fa\u683c\u5f0f\u5176\u6587\u4ef6\u540d\u79f0\u4e3axx00\uff0cxx01\u7b49\uff0c\u7528\u6237\u53ef\u4ee5\u901a\u8fc7\u6539\u53d8<\u8f93\u51fa\u683c\u5f0f>\u6765\u6539\u53d8\u8f93\u51fa\u7684\u6587\u4ef6\u540d <\/td><\/tr>
-f<\u8f93\u51fa\u5b57\u9996\u5b57\u7b26\u4e32>\u6216--prefix=<\u8f93\u51fa\u5b57\u9996\u5b57\u7b26\u4e32> <\/td>\u9884\u8bbe\u7684\u8f93\u51fa\u5b57\u9996\u5b57\u7b26\u4e32\u5176\u6587\u4ef6\u540d\u4e3axx00\uff0cxx01\u7b49\uff0c\u5982\u679c\u5236\u5b9a\u8f93\u51fa\u5b57\u9996\u5b57\u7b26\u4e32\u4e3a\u201chello\u201d\uff0c\u5219\u8f93\u51fa\u7684\u6587\u4ef6\u540d\u79f0\u4f1a\u53d8\u6210hello00\uff0chello\u300101…… <\/td><\/tr>
-k\u6216--keep-files <\/td>\u4fdd\u7559\u6587\u4ef6\uff0c\u5c31\u7b97\u53d1\u751f\u9519\u8bef\u6216\u4e2d\u65ad\u6267\u884c\uff0c\u4e0e\u4e0d\u80fd\u5220\u9664\u5df2\u7ecf\u8f93\u51fa\u4fdd\u5b58\u7684\u6587\u4ef6<\/td><\/tr>
-n<\u8f93\u51fa\u6587\u4ef6\u540d\u4f4d\u6570>\u6216--digits=<\u8f93\u51fa\u6587\u4ef6\u540d\u4f4d\u6570> <\/td>\u9884\u8bbe\u7684\u8f93\u51fa\u6587\u4ef6\u540d\u4f4d\u6570\u5176\u6587\u4ef6\u540d\u79f0\u4e3axx00\uff0cxx01……\u5982\u679c\u7528\u6237\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u4f4d\u6570\u4e3a\u201c3\u201d\uff0c\u5219\u8f93\u51fa\u7684\u6587\u4ef6\u540d\u79f0\u4f1a\u53d8\u6210xx000\uff0cxx001\u7b49<\/td><\/tr>
-q\u6216-s\u6216--quiet\u6216--silent <\/td>\u4e0d\u663e\u793a\u6307\u4ee4\u6267\u884c\u8fc7\u7a0b <\/td><\/tr>
-z\u6216--elide-empty-files <\/td>\u5220\u9664\u957f\u5ea6\u4e3a0 Byte\u6587\u4ef6\u3002 <\/td><\/tr><\/tbody><\/table>\n\n\n\n

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

\u5c06\u6587\u672c\u6587\u4ef6filename\u4ee5\u7b2c 2 \u884c\u4e3a\u5206\u754c\u70b9\u5207\u5272\u6210\u4e24\u4efd\uff1a <\/p>\n\n\n\n

[root@linuxcool ~]# csplit filename 2<\/pre>\n\n\n\n

\u5c06\u6587\u672c\u6587\u4ef6filename\u4ee5120\u884c\u4e3a\u5206\u754c\u70b9\u5207\u5272\u62102\u4efd\uff0c\u5e76\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u7684\u4f4d\u6570\u4e3a3\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# csplit -n 3 filename 120<\/pre>\n\n\n\n

\u5c06\u6587\u672c\u6587\u4ef6textfile\u4ee5120\u884c\u4e3a\u5206\u754c\u70b9\u5207\u5272\u62102\u4efd\uff0c\u5e76\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u7684\u524d\u7f18\u4e3afileName\u4f4d\u6570\u4e3a3\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# csplit -f fileName testfile 120 <\/pre>\n\n\n\n

\u5c06\u6587\u4ef6 filename \u4ee510\u884c\u4e3a\u5355\u4f4d\u5206\u52728\u6b21\uff0c\u5e76\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u7684\u683c\u5f0f :<\/p>\n\n\n\n

[root@linuxcool ~]# csplit -b \"myfile%o% filename 10 {8} <\/pre>\n\n\n\n

\u5c06\u6587\u672c\u6587\u4ef6 filename \u4ee5\u6bcf20\u884c\u4e3a\u5355\u4f4d\u5206\u5272\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# csplit filename 20 {*} <\/pre>\n\n\n\n

\u628a\u6587\u4ef6\u4ee5\u5b57\u7b26\u4e32”Chapter X”\u4e3a\u5206\u754c\u7b26\uff0c\u5206\u6210\u4e24\u90e8\u5206\uff1a<\/p>\n\n\n\n

[root@linuxcool ~]# csplit filename \/\"Chapter X\"\/  <\/pre>\n","protected":false},"excerpt":{"rendered":"

csplit\u547d\u4ee4\u7684\u82f1\u6587\u5168\u79f0\u662f\u201ccontext split\u201d\uff0c\u8be5\u547d\u4ee4\u7528\u4e8e\u5c06\u4e00\u4e2a\u5927\u6587\u4ef6\u5206\u5272\u6210\u5c0f\u7684\u788e\u7247\uff0c\u5e76\u4e14\u5c06\u5206\u5272\u540e […]<\/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\/1054"}],"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=1054"}],"version-history":[{"count":9,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1054\/revisions"}],"predecessor-version":[{"id":1850,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/posts\/1054\/revisions\/1850"}],"wp:attachment":[{"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/media?parent=1054"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/categories?post=1054"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.linuxcool.com\/wp-json\/wp\/v2\/tags?post=1054"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}