split:分割文件
简介split命令可以根据指定的行数或者指定的文件大小分割文件
说明
split命令可以根据指定的行数或者指定的文件大小分割文件
格式
split [option] [filename] [PREFIX]
PREFIX:输出文件名前缀
常用参数说明
- -b:指定分割后文件的最大字节数
- -l:指定分割后文件的最大行数
- -a:指定后缀长度,默认为2个字母
- -d:使用数字后缀
示例
1、指定行数进行分割
[root@localhost ~]# wc -l /apps/nginx/conf/nginx.conf
123 /apps/nginx/conf/nginx.conf
[root@localhost ~]# split -l 30 /apps/nginx/conf/nginx.conf nginx_
[root@localhost ~]# ll nginx_*
-rw-r--r--. 1 root root 619 Jun 4 01:24 nginx_aa
-rw-r--r--. 1 root root 670 Jun 4 01:24 nginx_ab
-rw-r--r--. 1 root root 990 Jun 4 01:24 nginx_ac
-rw-r--r--. 1 root root 677 Jun 4 01:24 nginx_ad
-rw-r--r--. 1 root root 10 Jun 4 01:24 nginx_ae
[root@localhost ~]# wc l nginx_*
wc: l: No such file or directory
30 50 619 nginx_aa
30 64 670 nginx_ab
30 87 990 nginx_ac
30 69 677 nginx_ad
3 2 10 nginx_ae
123 272 2966 total
2、指定后缀长度
[root@localhost ~]# split -l 30 -a 3 /apps/nginx/conf/nginx.conf nginx_
[root@localhost ~]# ll nginx_*
-rw-r--r--. 1 root root 619 Jun 4 01:27 nginx_aaa
-rw-r--r--. 1 root root 670 Jun 4 01:27 nginx_aab
-rw-r--r--. 1 root root 990 Jun 4 01:27 nginx_aac
-rw-r--r--. 1 root root 677 Jun 4 01:27 nginx_aad
-rw-r--r--. 1 root root 10 Jun 4 01:27 nginx_aae
[root@localhost ~]# wc l nginx_*
wc: l: No such file or directory
30 50 619 nginx_aaa
30 64 670 nginx_aab
30 87 990 nginx_aac
30 69 677 nginx_aad
3 2 10 nginx_aae
123 272 2966 total
3、使用数字后缀
[root@localhost ~]# split -l 30 -a 3 -d /apps/nginx/conf/nginx.conf nginx_
[root@localhost ~]# ll nginx_*
-rw-r--r--. 1 root root 619 Jun 4 01:27 nginx_000
-rw-r--r--. 1 root root 670 Jun 4 01:27 nginx_001
-rw-r--r--. 1 root root 990 Jun 4 01:27 nginx_002
-rw-r--r--. 1 root root 677 Jun 4 01:27 nginx_003
-rw-r--r--. 1 root root 10 Jun 4 01:27 nginx_004
[root@localhost ~]# wc l nginx_*
wc: l: No such file or directory
30 50 619 nginx_000
30 64 670 nginx_001
30 87 990 nginx_002
30 69 677 nginx_003
3 2 10 nginx_004
123 272 2966 total
4、按大小分割文件
[root@localhost ~]# split -b 1K -d /apps/nginx/conf/nginx.conf nginx_ #1kb分割
[root@localhost ~]# ll nginx_*
-rw-r--r--. 1 root root 1024 Jun 4 01:29 nginx_00
-rw-r--r--. 1 root root 1024 Jun 4 01:29 nginx_01
-rw-r--r--. 1 root root 918 Jun 4 01:29 nginx_02
前一篇博客中已经说过Golang对Gzip的处理,其实这是我的服务器端的处理,那么当我们服务器返回Gzip压缩的字符串后,客户端如何进行解压呢?本文主要记录下JavaScript对Gzip进行压缩和解压处理。
在PHP中,对二维数组排序还是非常简单的,但是在Golang中对二位数据排序显的就稍显麻烦,但是我们还是可以通过结构体来进行排序,本文主要记录Golang如何通过结构体的多个字段来进行排序。
按钮在我们开发过程中是少不了的,本节将介绍Flutter常用的一些按钮组件,例如:TextButton、OutlinedButton、ElevatedButton
通过sudo命令,可以让普通用户在执行指定命令或程序上,拥有超级管理员的权限。并有针对性将不同的命令授予指定的普通用户,同时普通用户不需要知道root的密码就可以得到授权,授权的方式可以通过visudo配置管理。
快速生成表格
Electron页面跳转、浏览器打开链接和打开新窗口
在使用Git的过程中,不想每次都输入用户名和密码去拉取代码,所以就需要保存这些信息,那么既然有保存了,就必须有清除功能。
在Mac电脑中,如何对Git的用户名和密码进行修改呢?起初不懂Mac,所以整了很久,本文将记录如何对这个进行操作,以便后期使用。
Docker编译镜像出现:fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz
ERROR: http://dl-cdn.alpinelinux.org/alpine/v3.12/main: temporary error (try again later)
WARNING: Ignoring APKINDEX.2c4ac24e.tar.gz: No such file or directory问题