article/linux/linux_split.md
2023-03-19 23:23:43 +08:00

35 lines
624 B
Markdown
Raw 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.

切分方法:
###### 查看文件的行数:
```
wc -l a.txt #查看a.txt文件共有多少行
```
###### 根据行数利用 split 命令切分文件
```
split -l 1000 a.txt -d -a 4 b_
```
将a.txt文件按照1000行来平分成若干个大小文件b_ 是要保存成的新文件的前缀后缀是指定的4位数字-d -a
例如b_0001 b_0002等
或者:
```
split -l 1000 a.txt b.txt #a.txt是要分割的文件 b.txt 是分割后生成的新文件
```
###### 根据文件大小利用split命令切分文件
```
split -b 10m a.txt b #将a.txt分割分割成大小为10m的多个文件
```