linux下的sort、uniq、join的使用

>>>Sort 命令常用相关选项:

选项

说明

-c

会检查文件顺序是否已排好序,如果乱序,则输出第一个乱序的行的相关信息,然后返回1

-k

指定排序的列数

-b

忽略每一行前面所有的空白行,从第一个可见的字符开始比较

-f

将小写字母都转换成大写字母进行排序

-r

反转降序

-u

去除重复行

-o

输出命名,重定向

-n

按字符来排序

-t

指定分隔符

-M

以月份排序







[root@localhost ~]#cat a.txt b.txt

1 abc

2 def

3 fun

4 hello

 

-------

1 beijing

2 we

3 fongguang

4

[root@localhost ~]#join a.txt b.txt

1 abc beijing

2 def we

3 fun fongguang

4 hello


猜你喜欢

转载自blog.51cto.com/13869849/2147701