Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3906022
  • 博文数量: 534
  • 博客积分: 10470
  • 博客等级: 上将
  • 技术积分: 4800
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-26 14:08
文章分类

全部博文(534)

文章存档

2021年(1)

2019年(1)

2017年(1)

2016年(2)

2013年(2)

2012年(10)

2011年(43)

2010年(10)

2009年(17)

2008年(121)

2007年(253)

2006年(73)

分类: LINUX

2008-10-21 15:22:40

可以使用sort, uniq 来作排序和统计

[gan@localhost ftmp]$ cat file.txt | sort
1
2
2
235
3
3
3
44
66
78
9900

[gan@localhost ftmp]$ cat file.txt | sort | uniq -c
      1 1
      2 2
      1 235
      3 3
      1 44
      1 66
      1 78
      1 9900

统计某类字符出现的次数:
[gan@localhost ftmp]$ grep 2 file.txt
2
2
235
[gan@localhost ftmp]$ grep -c 2 file.txt
3

阅读(2070) | 评论(0) | 转发(0) |
0

上一篇:awk --- 算术运算

下一篇:ORA-06512 get_ddl

给主人留下些什么吧!~~