NotePublic/Software/Applications/Split/Split_切分文件.md

32 lines
692 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Split 切分文件
当面临将一个大文件进行切分时linux 的 split 命令是很好的选择。它包含多种参数,支持按行、大小进行切分。
split 命令的语法如下:
```bash
split [--help][--version][-a ][-b][-C ][-d][-l ] <input file> <output file prefix>
```
## 按行数分割
```bash
split -l 300 <input file> <output file prefix>
```
加上 -d使用数字后缀加上 --verbose显示分割进度
```bash
split --verbose -l50000 -d <input file> <output file prefix>
```
## 按字节大小分割
```bash
split -b 10m <input file> <output file prefix>
```
## 合并文件
参见 [《Cat 合并文件》](../Cat/Cat_合并文件.md)