亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫(kù)
12下一頁(yè)
最近訪問(wèn)板塊 發(fā)新帖
查看: 2962 | 回復(fù): 10
打印 上一主題 下一主題

[數(shù)值計(jì)算] 請(qǐng)教依據(jù)條件作統(tǒng)計(jì) [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2013-05-15 21:59 |只看該作者 |倒序?yàn)g覽
本帖最后由 xmi 于 2013-05-15 22:29 編輯

請(qǐng)教各位我想把以下的作個(gè)統(tǒng)計(jì), 想得出2 個(gè)不同結(jié)果:
15May13-04:45:19:164 A/1   (3) apple at APP05 a1
15May13-06:45:23:846 A/1   (3) apple at APP02 a2
15May13-08:07:54:535 A/1   (3) apple at APP02 a2
15May13-09:19:43:138 A/1   (3) apple at APP02 a2
15May13-10:25:53:856 A/1   (3) apple at APP03 a12
15May13-10:27:43:971 A/1   (3) apple at APP02 a3
15May13-02:37:57:981 A/1   (3) apple at APP04 a4
15May13-02:37:58:895 A/1   (3) orange at OOP12 a1
15May13-02:38:09:756 A/1   (3) orange at OOP08 a3
15May13-02:38:16:095 A/1   (3) orange at OOP11 a11
15May13-02:41:27:961 A/1   (3) orange at OOP10 a34
15May13-02:42:52:505 A/1   (3) orange at OOP12 a2
15May13-04:21:48:867 A/1   (3) pear at PEA12 a23
15May13-06:07:41:565 A/1   (3) pear at PEA12 a24



結(jié)果如附件...

謝謝!

result.jpg (58.18 KB, 下載次數(shù): 78)

result

result

論壇徽章:
13
丑牛
日期:2013-08-16 15:08:22技術(shù)圖書徽章
日期:2013-11-26 10:13:40雙魚座
日期:2013-11-08 15:03:26戌狗
日期:2013-11-08 13:52:30技術(shù)圖書徽章
日期:2013-11-05 14:06:30戌狗
日期:2013-10-31 11:45:42CU十二周年紀(jì)念徽章
日期:2013-10-24 15:41:34天秤座
日期:2013-10-11 14:55:08子鼠
日期:2013-09-26 19:36:35水瓶座
日期:2013-09-26 17:44:56午馬
日期:2013-08-26 10:24:23丑牛
日期:2013-08-19 14:43:22
2 [報(bào)告]
發(fā)表于 2013-05-15 23:35 |只看該作者
先回答著,明天再繼續(xù)修改
結(jié)果一:
  1. awk '{a[$4" "$6]++}END{for(i in a)print i,a[i]}' test | sort -nk +1 | awk '{if(!a[$1]++){split($0,b);print b[1]}}1'   
  2. apple
  3. apple APP02 4
  4. apple APP03 1
  5. apple APP04 1
  6. apple APP05 1
  7. orange
  8. orange OOP08 1
  9. orange OOP10 1
  10. orange OOP11 1
  11. orange OOP12 2
  12. pear
  13. pear PEA12 2
復(fù)制代碼
結(jié)果2:
  1. awk '{a[$4" "$6" "$7]++}END{for(i in a)print i,a[i]}' test | sort -nk +1 | awk '{if(!a[$1]++){split($0,b);print b[1]}}1'
  2. apple
  3. apple APP02 a2 3
  4. apple APP02 a3 1
  5. apple APP03 a12 1
  6. apple APP04 a4 1
  7. apple APP05 a1 1
  8. orange
  9. orange OOP08 a3 1
  10. orange OOP10 a34 1
  11. orange OOP11 a11 1
  12. orange OOP12 a1 1
  13. orange OOP12 a2 1
  14. pear
  15. pear PEA12 a23 1
  16. pear PEA12 a24 1
復(fù)制代碼

論壇徽章:
32
處女座
日期:2013-11-20 23:41:20雙子座
日期:2014-06-11 17:20:43戌狗
日期:2014-06-16 11:05:00處女座
日期:2014-07-22 17:30:47獅子座
日期:2014-07-28 15:38:17金牛座
日期:2014-08-05 16:34:01亥豬
日期:2014-08-18 13:34:25白羊座
日期:2014-09-02 15:03:55金牛座
日期:2014-11-10 10:23:58處女座
日期:2014-12-02 09:17:52程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-06-16 22:20:002015亞冠之塔什干火車頭
日期:2015-06-20 23:28:22
3 [報(bào)告]
發(fā)表于 2013-05-16 09:30 |只看該作者
本帖最后由 yestreenstars 于 2013-05-16 09:31 編輯
  1. [root@localhost ~]# cat i
  2. 15May13-04:45:19:164 A/1   (3) apple at APP05 a1
  3. 15May13-06:45:23:846 A/1   (3) apple at APP02 a2
  4. 15May13-08:07:54:535 A/1   (3) apple at APP02 a2
  5. 15May13-09:19:43:138 A/1   (3) apple at APP02 a2
  6. 15May13-10:25:53:856 A/1   (3) apple at APP03 a12
  7. 15May13-10:27:43:971 A/1   (3) apple at APP02 a3
  8. 15May13-02:37:57:981 A/1   (3) apple at APP04 a4
  9. 15May13-02:37:58:895 A/1   (3) orange at OOP12 a1
  10. 15May13-02:38:09:756 A/1   (3) orange at OOP08 a3
  11. 15May13-02:38:16:095 A/1   (3) orange at OOP11 a11
  12. 15May13-02:41:27:961 A/1   (3) orange at OOP10 a34
  13. 15May13-02:42:52:505 A/1   (3) orange at OOP12 a2
  14. 15May13-04:21:48:867 A/1   (3) pear at PEA12 a23
  15. 15May13-06:07:41:565 A/1   (3) pear at PEA12 a24
  16. [root@localhost ~]# awk '{a[$4];b[$6];c[$4,$6]++}END{for(i=1;i<=asorti(a,d);i++){print d[i];for(j in b)if(c[d[i],j])print d[i],j,c[d[i],j]}}' i
  17. apple
  18. apple APP02 4
  19. apple APP03 1
  20. apple APP04 1
  21. apple APP05 1
  22. orange
  23. orange OOP08 1
  24. orange OOP10 1
  25. orange OOP11 1
  26. orange OOP12 2
  27. pear
  28. pear PEA12 2
  29. [root@localhost ~]# awk '{a[$4];b[$6];c[$7];d[$4,$6,$7]++}END{for(i=1;i<=asorti(a,e);i++){print e[i];for(j in b)for(k in c)if(d[e[i],j,k])print e[i],j,k,d[e[i],j,k]}}' i
  30. apple
  31. apple APP02 a2 3
  32. apple APP02 a3 1
  33. apple APP03 a12 1
  34. apple APP04 a4 1
  35. apple APP05 a1 1
  36. orange
  37. orange OOP08 a3 1
  38. orange OOP10 a34 1
  39. orange OOP11 a11 1
  40. orange OOP12 a1 1
  41. orange OOP12 a2 1
  42. pear
  43. pear PEA12 a23 1
  44. pear PEA12 a24 1
  45. [root@localhost ~]#
復(fù)制代碼

論壇徽章:
0
4 [報(bào)告]
發(fā)表于 2013-05-16 09:37 |只看該作者
本帖最后由 心若寒江雪 于 2013-05-16 09:39 編輯

[root@test1 opt]# awk '{b[$4"\t"$6]++}END{for(i in b){printf "%s\t %s\n",i,b}}' file
orange  OOP12    2
apple   APP02    4
apple   APP03    1
apple   APP04    1
orange  OOP08    1
apple   APP05    1
pear    PEA12    2
orange  OOP10    1
orange  OOP11    1
[root@test1 opt]# awk '{b[$4"\t"$6"\t"$7]++}END{for(i in b){printf "%s\t %s\n",i,b}}' file
orange  OOP08   a3       1
orange  OOP12   a1       1
apple   APP05   a1       1
orange  OOP12   a2       1
apple   APP04   a4       1
apple   APP03   a12      1
orange  OOP11   a11      1
pear    PEA12   a23      1
apple   APP02   a2       3
pear    PEA12   a24      1
apple   APP02   a3       1
orange  OOP10   a34      1

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2013-05-16 18:57 |只看該作者
厲害。{:3_200:}學(xué)習(xí)了。

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2013-05-16 21:39 |只看該作者
本帖最后由 xmi 于 2013-05-16 21:43 編輯

回復(fù) 2# 代號(hào):軍刀


   很利害呀, 真的萬(wàn)謝意!!衷心感激烈!  想不到會(huì)做到... 請(qǐng)教可否解說(shuō)一下? 請(qǐng)問(wèn)可把結(jié)果的每一欄也弄齊整嗎?
   你說(shuō)再修改... 可如何再修改呢?

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2013-05-16 21:40 |只看該作者
本帖最后由 xmi 于 2013-05-16 21:44 編輯

回復(fù) 3# yestreenstars


    很利害呀, 真的萬(wàn)謝意!!衷心感激!  我試試看...請(qǐng)問(wèn)可把結(jié)果的每一欄也弄齊整嗎?

論壇徽章:
0
8 [報(bào)告]
發(fā)表于 2013-05-16 21:43 |只看該作者
回復(fù) 4# 心若寒江雪


    很利害呀, 真的萬(wàn)謝意!!衷心感激! ..學(xué)習(xí)學(xué)習(xí).... 請(qǐng)問(wèn)可把結(jié)果的每一欄也弄齊嗎?

論壇徽章:
0
9 [報(bào)告]
發(fā)表于 2013-05-16 23:12 |只看該作者
現(xiàn)在就是對(duì)齊的,只是貼出來(lái)不是了
回復(fù) 8# xmi


   

論壇徽章:
32
處女座
日期:2013-11-20 23:41:20雙子座
日期:2014-06-11 17:20:43戌狗
日期:2014-06-16 11:05:00處女座
日期:2014-07-22 17:30:47獅子座
日期:2014-07-28 15:38:17金牛座
日期:2014-08-05 16:34:01亥豬
日期:2014-08-18 13:34:25白羊座
日期:2014-09-02 15:03:55金牛座
日期:2014-11-10 10:23:58處女座
日期:2014-12-02 09:17:52程序設(shè)計(jì)版塊每日發(fā)帖之星
日期:2015-06-16 22:20:002015亞冠之塔什干火車頭
日期:2015-06-20 23:28:22
10 [報(bào)告]
發(fā)表于 2013-05-17 09:02 |只看該作者
改一下分隔符就好了:
  1. [root@localhost ~]# awk -vOFS='\t' '{a[$4];b[$6];c[$4,$6]++}END{for(i=1;i<=asorti(a,d);i++){print d[i];for(j in b)if(c[d[i],j])print d[i],j,c[d[i],j]}}' i
  2. apple
  3. apple   APP02   4
  4. apple   APP03   1
  5. apple   APP04   1
  6. apple   APP05   1
  7. orange
  8. orange  OOP08   1
  9. orange  OOP10   1
  10. orange  OOP11   1
  11. orange  OOP12   2
  12. pear
  13. pear    PEA12   2
  14. [root@localhost ~]# awk -vOFS='\t' '{a[$4];b[$6];c[$7];d[$4,$6,$7]++}END{for(i=1;i<=asorti(a,e);i++){print e[i];for(j in b)for(k in c)if(d[e[i],j,k])print e[i],j,k,d[e[i],j,k]}}' i
  15. apple
  16. apple   APP02   a2      3
  17. apple   APP02   a3      1
  18. apple   APP03   a12     1
  19. apple   APP04   a4      1
  20. apple   APP05   a1      1
  21. orange
  22. orange  OOP08   a3      1
  23. orange  OOP10   a34     1
  24. orange  OOP11   a11     1
  25. orange  OOP12   a1      1
  26. orange  OOP12   a2      1
  27. pear
  28. pear    PEA12   a23     1
  29. pear    PEA12   a24     1
  30. [root@localhost ~]#
復(fù)制代碼
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國(guó)互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過(guò)ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP