-
| 管道
[root@localhost ~]
-
grep 搜索文本
[root@localhost ~]
| 参数 | 含义 |
|---|
| i | 不区分大小写 |
| v | 反向匹配 |
| n | 输出行号 |
| c | 统计包含匹配的行数 |
-
sort 排序
[root@localhost ~]
| 参数 | 含义 |
|---|
| n | 采取数字排序 |
| t | 指定分隔符 |
| k | 指定第几列 |
| r | 反向排序 |
[root@localhost test]
b:3
c:2
a:4
e:5
d:1
f:11
[root@localhost test]
a:4
b:3
c:2
d:1
e:5
f:11
[root@localhost test]
f:11
e:5
d:1
c:2
b:3
a:4
[root@localhost test]
d:1
f:11
c:2
b:3
a:4
e:5
[root@localhost test]
d:1
c:2
b:3
a:4
e:5
f:11
[root@localhost test]
-
uniq 删除重复内容
[root@localhost test]
[root@localhost test]
asd
123
asd
123
[root@localhost test]
123
asd
[root@localhost test]
2 123
2 asd
[root@localhost test]
-
cut 截取文本
[root@localhost test]
[root@localhost test]
[root@localhost test]
root:/root
bin:/bin
admin:/home/admin
john:/home/john
[root@localhost test]
-
tr 文本替换
[root@localhost test]
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
BIN:X:1:1:BIN:/BIN:/SBIN/NOLOGIN
ADMIN:X:1000:1000::/HOME/ADMIN:/BIN/BASH
JOHN:X:1001:1001::/HOME/JOHN:/BIN/BASH
[root@localhost test]
[root@localhost test]
rootx00root/root/bin/bash
binx11bin/bin/sbin/nologin
adminx10001000/home/admin/bin/bash
johnx10011001/home/john/bin/bash
[root@localhost test]
-
paste 文本合并
[root@localhost test]
1
2
3
[root@localhost test]
a
b
c
[root@localhost test]
1 a
2 b
3 c
[root@localhost test]
1:a
2:b
3:c
[root@localhost test]
-
spit 分割大文件
[root@localhost test]
[root@localhost test]