sort -nu 参数的实验记录,各种条件去重

最近有一个需求,就是我公司的数据,需要从A公司给的数据中提取。然后呢,这个数据中,是一个个的数据对,

先写上,然后在总结,直接举个例子最方便了,一看你就知道怎么回事

cat是从上到下读,tac是从下到上读

  
  
  
  
  1. $ cat aaa.log|sort -u > test1  
  2. $ tac aaa.log|sort -u > test2  
  3. $ cat aaa.log|sort -nu > test3  
  4. $ tac aaa.log|sort -nu > test4  
  5. $ wc -l *  
  6.   1422057 test1  
  7.   1422057 test2  
  8.    774445 test3  
  9.    774445 test4  
  10.   2082926 aaa.log  
  11.   4393004 总计  
  12. $ md5sum *  
  13. f8947342c995a9ab3fc831cc5e1fa9f9  test1  
  14. f8947342c995a9ab3fc831cc5e1fa9f9  test2  
  15. 950496d8fa74f2cffc176311c201768a  test3  
  16. e09e68c109f7debbc83f7a2e0ab0051f  test4  
  17. bc87246cf74953ce6f13342d9b8258e1  aaa.log  
  18. $ cat aaa.log|grep 123456  
  19. 123456:3525  
  20. 123456:3515  
  21. 123456:3550  
  22. 123456:3515  
  23. $ cat test1|grep 123456  
  24. 123456:3515  
  25. 123456:3525  
  26. 123456:3550  
  27. $ cat test2|grep 123456  
  28. 123456:3515  
  29. 123456:3525  
  30. 123456:3550  
  31. $ cat test3|grep 123456  
  32. 123456:3525  
  33. $ cat test4|grep 123456  
  34. 123456:3515 

 

 

 

本文出自 “周旭光_不断进取” 博客,谢绝转载!

你可能感兴趣的:(数据,去重,职场,sort,休闲)