{"id":220617,"date":"2021-06-22T09:02:05","date_gmt":"2021-06-22T01:02:05","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=220617"},"modified":"2021-06-15T09:04:17","modified_gmt":"2021-06-15T01:04:17","slug":"linux-split-files","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-split-files.html","title":{"rendered":"\u5982\u4f55\u5728 Linux\u4e0b\u8fdb\u884c\u6587\u4ef6\u5207\u5272\u64cd\u4f5c\uff1f"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u5f80\u5f80\u662f\u56e0\u4e3a\u7f51\u7edc\u4f20\u8f93\u7684\u9650\u5236\uff0c\u5bfc\u81f4\u5f88\u591a\u65f6\u5019\uff0c\u6211\u4eec\u9700\u8981\u5728 Linux \u7cfb\u7edf\u4e0b\u8fdb\u884c\u5927\u6587\u4ef6\u7684\u5207\u5272\u3002\u8fd9\u6837\u5c06\u4e00\u4e2a\u5927\u6587\u4ef6\u5207\u5272\u6210\u4e3a\u591a\u4e2a\u5c0f\u6587\u4ef6\uff0c\u8fdb\u884c\u4f20\u8f93\uff0c\u4f20\u8f93\u5b8c\u6bd5\u4e4b\u540e\u8fdb\u884c\u5408\u5e76\u5373\u53ef\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

1. \u6587\u4ef6\u5207\u5272 - split<\/strong><\/div>\n

\u5728 Linux \u7cfb\u7edf\u4e0b\u4f7f\u7528 split \u547d\u4ee4\u8fdb\u884c\u5927\u6587\u4ef6\u5207\u5272\u5f88\u65b9\u4fbf<\/p>\n

\u00a0[1] \u547d\u4ee4\u8bed\u6cd5<\/strong><\/span><\/div>\n
#\u00a0-a:\u00a0\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u7684\u540e\u7f00\u957f\u5ea6(\u9ed8\u8ba4\u4e3a2\u4e2a:aa,ab...)\r\n#\u00a0-d:\u00a0\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u7684\u540e\u7f00\u7528\u6570\u5b57\u4ee3\u66ff\r\n#\u00a0-l:\u00a0\u884c\u6570\u5206\u5272\u6a21\u5f0f(\u6307\u5b9a\u6bcf\u591a\u5c11\u884c\u5207\u6210\u4e00\u4e2a\u5c0f\u6587\u4ef6;\u9ed8\u8ba4\u884c\u6570\u662f1000\u884c)\r\n#\u00a0-b:\u00a0\u4e8c\u8fdb\u5236\u5206\u5272\u6a21\u5f0f(\u652f\u6301\u5355\u4f4d:k\/m)\r\n#\u00a0-C:\u00a0\u6587\u4ef6\u5927\u5c0f\u5206\u5272\u6a21\u5f0f(\u5207\u5272\u65f6\u5c3d\u91cf\u7ef4\u6301\u6bcf\u884c\u7684\u5b8c\u6574\u6027)\r\nsplit\u00a0[-a]\u00a0[-d]\u00a0[-l\u00a0<\u884c\u6570>]\u00a0[-b\u00a0<\u5b57\u8282>]\u00a0[-C\u00a0<\u5b57\u8282>]\u00a0[\u8981\u5207\u5272\u7684\u6587\u4ef6]\u00a0[\u8f93\u51fa\u6587\u4ef6\u540d]<\/pre>\n
[2] \u4f7f\u7528\u5b9e\u4f8b<\/strong><\/span><\/div>\n
#\u00a0\u884c\u5207\u5272\u6587\u4ef6\r\n$\u00a0split\u00a0-l\u00a0300000\u00a0users.sql\u00a0\/data\/users_\r\n#\u00a0\u4f7f\u7528\u6570\u5b57\u540e\u7f00\r\n$\u00a0split\u00a0-d\u00a0-l\u00a0300000\u00a0users.sql\u00a0\/data\/users_\r\n#\u00a0\u6309\u5b57\u8282\u5927\u5c0f\u5206\u5272\r\n$\u00a0split\u00a0-d\u00a0-b\u00a0100m\u00a0users.sql\u00a0\/data\/users_<\/pre>\n
\u00a0[3] \u5e2e\u52a9\u4fe1\u606f<\/strong><\/span><\/div>\n
#\u00a0\u5e2e\u52a9\u4fe1\u606f\r\n$\u00a0split\u00a0--help\r\nUsage:\u00a0split\u00a0[OPTION]...\u00a0[FILE\u00a0[PREFIX]]\r\nOutput\u00a0pieces\u00a0of\u00a0FILE\u00a0to\u00a0PREFIXaa,\u00a0PREFIXab,\u00a0...;\r\ndefault\u00a0size\u00a0is\u00a01000\u00a0lines,\u00a0and\u00a0default\u00a0PREFIX\u00a0is\u00a0'x'.\r\nWith\u00a0no\u00a0FILE,\u00a0or\u00a0when\u00a0FILE\u00a0is\u00a0-,\u00a0read\u00a0standard\u00a0input.\r\nMandatory\u00a0arguments\u00a0to\u00a0long\u00a0options\u00a0are\u00a0mandatory\u00a0for\u00a0short\u00a0options\u00a0too.\r\n\u00a0\u00a0-a,\u00a0--suffix-length=N\u00a0\u00a0\u00a0generate\u00a0suffixes\u00a0of\u00a0length\u00a0N\u00a0(default\u00a02)\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u540e\u7f00\u540d\u79f0\u7684\u957f\u5ea6(\u9ed8\u8ba4\u4e3a2)\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--additional-suffix=SUFFIX\u00a0\u00a0append\u00a0an\u00a0additional\u00a0SUFFIX\u00a0to\u00a0file\u00a0names\r\n\u00a0\u00a0-b,\u00a0--bytes=SIZE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0put\u00a0SIZE\u00a0bytes\u00a0per\u00a0output\u00a0file\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u6bcf\u4e2a\u8f93\u51fa\u6587\u4ef6\u7684\u5b57\u8282\u5927\u5c0f\r\n\u00a0\u00a0-C,\u00a0--line-bytes=SIZE\u00a0\u00a0\u00a0put\u00a0at\u00a0most\u00a0SIZE\u00a0bytes\u00a0of\u00a0records\u00a0per\u00a0output\u00a0file\u00a0\u00a0\u00a0\u00a0\u6bcf\u4e2a\u8f93\u51fa\u6587\u4ef6\u7684\u6700\u5927\u5b57\u8282\u5927\u5c0f\r\n\u00a0\u00a0-d\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0use\u00a0numeric\u00a0suffixes\u00a0starting\u00a0at\u00a00,\u00a0not\u00a0alphabetic\u00a0\u00a0\u00a0\u4f7f\u7528\u6570\u5b57\u540e\u7f00\u4ee3\u66ff\u5b57\u6bcd\u540e\u7f00\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--numeric-suffixes[=FROM]\u00a0\u00a0same\u00a0as\u00a0-d,\u00a0but\u00a0allow\u00a0setting\u00a0the\u00a0start\u00a0value\r\n\u00a0\u00a0-e,\u00a0--elide-empty-files\u00a0\u00a0do\u00a0not\u00a0generate\u00a0empty\u00a0output\u00a0files\u00a0with\u00a0'-n'\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u4e0d\u4ea7\u751f\u7a7a\u7684\u8f93\u51fa\u6587\u4ef6\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--filter=COMMAND\u00a0\u00a0\u00a0\u00a0write\u00a0to\u00a0shell\u00a0COMMAND;\u00a0file\u00a0name\u00a0is\u00a0$FILE\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u5199\u5165\u5230shell\u547d\u4ee4\u884c\r\n\u00a0\u00a0-l,\u00a0--lines=NUMBER\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0put\u00a0NUMBER\u00a0lines\/records\u00a0per\u00a0output\u00a0file\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u8bbe\u5b9a\u6bcf\u4e2a\u8f93\u51fa\u6587\u4ef6\u7684\u884c\u6570\r\n\u00a0\u00a0-n,\u00a0--number=CHUNKS\u00a0\u00a0\u00a0\u00a0\u00a0generate\u00a0CHUNKS\u00a0output\u00a0files;\u00a0see\u00a0explanation\u00a0below\u00a0\u00a0\u4ea7\u751fchunks\u6587\u4ef6\r\n\u00a0\u00a0-t,\u00a0--separator=SEP\u00a0\u00a0\u00a0\u00a0\u00a0use\u00a0SEP\u00a0instead\u00a0of\u00a0newline\u00a0as\u00a0the\u00a0record\u00a0separator;\u00a0\u00a0\u4f7f\u7528\u65b0\u5b57\u7b26\u5206\u5272\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'\\0'\u00a0(zero)\u00a0specifies\u00a0the\u00a0NUL\u00a0character\r\n\u00a0\u00a0-u,\u00a0--unbuffered\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0immediately\u00a0copy\u00a0input\u00a0to\u00a0output\u00a0with\u00a0'-n\u00a0r\/...'\u00a0\u00a0\u00a0\u00a0\u00a0\u65e0\u9700\u7f13\u5b58\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--verbose\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0print\u00a0a\u00a0diagnostic\u00a0just\u00a0before\u00a0each\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u663e\u793a\u5206\u5272\u8fdb\u5ea6\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0output\u00a0file\u00a0is\u00a0opened\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--help\u00a0\u00a0\u00a0\u00a0\u00a0display\u00a0this\u00a0help\u00a0and\u00a0exit\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--version\u00a0\u00a0output\u00a0version\u00a0information\u00a0and\u00a0exit\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u663e\u793a\u7248\u672c\u4fe1\u606f\r\nThe\u00a0SIZE\u00a0argument\u00a0is\u00a0an\u00a0integer\u00a0and\u00a0optional\u00a0unit\u00a0(example:\u00a010K\u00a0is\u00a010*1024).\r\nUnits\u00a0are\u00a0K,M,G,T,P,E,Z,Y\u00a0(powers\u00a0of\u00a01024)\u00a0or\u00a0KB,MB,...\u00a0(powers\u00a0of\u00a01000).\r\nCHUNKS\u00a0may\u00a0be:\r\n\u00a0\u00a0N\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0split\u00a0into\u00a0N\u00a0files\u00a0based\u00a0on\u00a0size\u00a0of\u00a0input\r\n\u00a0\u00a0K\/N\u00a0\u00a0\u00a0\u00a0\u00a0output\u00a0Kth\u00a0of\u00a0N\u00a0to\u00a0stdout\r\n\u00a0\u00a0l\/N\u00a0\u00a0\u00a0\u00a0\u00a0split\u00a0into\u00a0N\u00a0files\u00a0without\u00a0splitting\u00a0lines\/records\r\n\u00a0\u00a0l\/K\/N\u00a0\u00a0\u00a0output\u00a0Kth\u00a0of\u00a0N\u00a0to\u00a0stdout\u00a0without\u00a0splitting\u00a0lines\/records\r\n\u00a0\u00a0r\/N\u00a0\u00a0\u00a0\u00a0\u00a0like\u00a0'l'\u00a0but\u00a0use\u00a0round\u00a0robin\u00a0distribution\r\n\u00a0\u00a0r\/K\/N\u00a0\u00a0\u00a0likewise\u00a0but\u00a0only\u00a0output\u00a0Kth\u00a0of\u00a0N\u00a0to\u00a0stdout\r\nGNU\u00a0coreutils\u00a0online\u00a0help:\u00a0<http:\/\/www.gnu.org\/software\/coreutils\/>\r\nFull\u00a0documentation\u00a0at:\u00a0<http:\/\/www.gnu.org\/software\/coreutils\/split>\r\nor\u00a0available\u00a0locally\u00a0via:\u00a0info\u00a0'(coreutils)\u00a0split\u00a0invocation'<\/pre>\n
2. \u6587\u4ef6\u5408\u5e76 - cat<\/strong><\/div>\n

\u5728 Linux \u7cfb\u7edf\u4e0b\u4f7f\u7528 cat \u547d\u4ee4\u8fdb\u884c\u591a\u4e2a\u5c0f\u6587\u4ef6\u7684\u5408\u5e76\u4e5f\u5f88\u65b9\u4fbf<\/p>\n

[1] \u547d\u4ee4\u8bed\u6cd5<\/strong><\/span><\/div>\n
#\u00a0-n:\u00a0\u663e\u793a\u884c\u53f7\r\n#\u00a0-e:\u00a0\u4ee5$\u5b57\u7b26\u4f5c\u4e3a\u6bcf\u884c\u7684\u7ed3\u5c3e\r\n#\u00a0-t:\u00a0\u663e\u793aTAB\u5b57\u7b26(^I)\r\ncat\u00a0[-n]\u00a0[-e]\u00a0[-t]\u00a0[\u8f93\u51fa\u6587\u4ef6\u540d]<\/pre>\n
[2] \u4f7f\u7528\u5b9e\u4f8b<\/strong><\/span><\/div>\n
#\u00a0\u5408\u5e76\u6587\u4ef6\r\n$\u00a0cat\u00a0\/data\/users_*\u00a0>\u00a0users.sql<\/pre>\n
[3] \u5e2e\u52a9\u4fe1\u606f<\/strong><\/span><\/div>\n
#\u00a0\u5e2e\u52a9\u4fe1\u606f\r\n$\u00a0cat\u00a0--h\r\nUsage:\u00a0cat\u00a0[OPTION]...\u00a0[FILE]...\r\nConcatenate\u00a0FILE(s)\u00a0to\u00a0standard\u00a0output.\r\nWith\u00a0no\u00a0FILE,\u00a0or\u00a0when\u00a0FILE\u00a0is\u00a0-,\u00a0read\u00a0standard\u00a0input.\r\n\u00a0\u00a0-A,\u00a0--show-all\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0equivalent\u00a0to\u00a0-vET\r\n\u00a0\u00a0-b,\u00a0--number-nonblank\u00a0\u00a0\u00a0\u00a0number\u00a0nonempty\u00a0output\u00a0lines,\u00a0overrides\u00a0-n\r\n\u00a0\u00a0-e\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0equivalent\u00a0to\u00a0-vE\r\n\u00a0\u00a0-E,\u00a0--show-ends\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0display\u00a0$\u00a0at\u00a0end\u00a0of\u00a0each\u00a0line\r\n\u00a0\u00a0-n,\u00a0--number\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0number\u00a0all\u00a0output\u00a0lines\r\n\u00a0\u00a0-s,\u00a0--squeeze-blank\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0suppress\u00a0repeated\u00a0empty\u00a0output\u00a0lines\r\n\u00a0\u00a0-t\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0equivalent\u00a0to\u00a0-vT\r\n\u00a0\u00a0-T,\u00a0--show-tabs\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0display\u00a0TAB\u00a0characters\u00a0as\u00a0^I\r\n\u00a0\u00a0-u\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(ignored)\r\n\u00a0\u00a0-v,\u00a0--show-nonprinting\u00a0\u00a0\u00a0use\u00a0^\u00a0and\u00a0M-\u00a0notation,\u00a0except\u00a0for\u00a0LFD\u00a0and\u00a0TAB\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--help\u00a0\u00a0\u00a0\u00a0\u00a0display\u00a0this\u00a0help\u00a0and\u00a0exit\r\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0--version\u00a0\u00a0output\u00a0version\u00a0information\u00a0and\u00a0exit\r\nExamples:\r\n\u00a0\u00a0cat\u00a0f\u00a0-\u00a0g\u00a0\u00a0Output\u00a0f's\u00a0contents,\u00a0then\u00a0standard\u00a0input,\u00a0then\u00a0g's\u00a0contents.\r\n\u00a0\u00a0cat\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Copy\u00a0standard\u00a0input\u00a0to\u00a0standard\u00a0output.\r\nGNU\u00a0coreutils\u00a0online\u00a0help:\u00a0<http:\/\/www.gnu.org\/software\/coreutils\/>\r\nFull\u00a0documentation\u00a0at:\u00a0<http:\/\/www.gnu.org\/software\/coreutils\/cat>\r\nor available locally via: info '(coreutils) cat invocation'\r\n<\/pre>\n
3. \u53c2\u8003\u6587\u6863<\/strong><\/div>\n
    \n
  • \u00a0Linux \u5927\u6587\u4ef6\u7684\u5206\u5272\u4e0e\u5408\u5e76<\/li>\n
  • \u00a0Linux \u5b66\u4e60\u2013\u6587\u4ef6\u5206\u5272\u4e0e\u5408\u5e76<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"

    \u5728 Linux \u7cfb\u7edf\u4e0b\u4f7f\u7528 split \u547d\u4ee4\u8fdb\u884c\u5927\u6587\u4ef6\u5207\u5272\u5f88\u65b9\u4fbf #\u00a0-a:\u00a0\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d\u7684\u540e\u7f00\u957f\u5ea6(\u9ed8\u8ba4\u4e3a […]<\/p>\n","protected":false},"author":323,"featured_media":83294,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-220617","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/220617","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/323"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=220617"}],"version-history":[{"count":3,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/220617\/revisions"}],"predecessor-version":[{"id":220621,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/220617\/revisions\/220621"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/83294"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=220617"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=220617"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=220617"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}