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

相关文章:

  • 2021-10-13
  • 2021-12-18
  • 2021-12-02
  • 2022-02-21
  • 2021-04-30
  • 2022-12-23
  • 2021-08-24
  • 2021-06-13
猜你喜欢
  • 2021-12-09
  • 2021-10-05
  • 2022-01-13
  • 2022-12-23
  • 2021-11-09
  • 2022-12-23
  • 2021-06-21
相关资源
相似解决方案