shell中常用的命令:sort和uniq

shell中常用的命令:sort和uniq

1.sort命令和uniq命令的用法

sort命令通常用来排序
uniq命令对重复字符做相应的处理

shell中常用的命令:sort和uniq

2.命令的使用例子

sort :只对数字的第一位正向排序

shell中常用的命令:sort和uniq

sort -n :纯数字正相排序

shell中常用的命令:sort和uniq

sort -rn :纯数字倒序

shell中常用的命令:sort和uniq

sort -o :将排序结果输出到指定文件中

shell中常用的命令:sort和uniq

sort -u :去掉重复数字并只对数字的第一位正向排序

shell中常用的命令:sort和uniq

sort -urn :去掉重复数字并纯数字倒序

shell中常用的命令:sort和uniq

uniq -c:每行显示一次并统计重复行数

shell中常用的命令:sort和uniq

uniq -d:显示重复的行

shell中常用的命令:sort和uniq

uniq -u:显示唯一的行

shell中常用的命令:sort和uniq

sort -k :指定要排序的列 -t :指定分隔符

shell中常用的命令:sort和uniq

3.命令的练习题:对指定信息进行排序

要求:

shell中常用的命令:sort和uniq按照员工姓名进行排序:
shell中常用的命令:sort和uniq
按照员工身高进行排序:
shell中常用的命令:sort和uniq