Questions tagged «uniq»

3
uniq命令无法正常工作?
所以我正在检查md5文件的哈希,并以此作为输出: 657cf4512a77bf47c39a0482be8e41e0 ./dupes2.txt 657cf4512a77bf47c39a0482be8e41e0 ./dupes.txt 8d60a927ce0f411ec94ac26a4785f749 ./derpina.txt 15f63928b8a1d5337137c38b5d66eed3 ./foo.txt 8d60a927ce0f411ec94ac26a4785f749 ./derp.txt 但是,在find . -type f -exec md5sum '{}' ';' | uniq -w 33找到唯一的哈希之后,我得到了: 657cf4512a77bf47c39a0482be8e41e0 ./dupes2.txt 8d60a927ce0f411ec94ac26a4785f749 ./derpina.txt 15f63928b8a1d5337137c38b5d66eed3 ./foo.txt 8d60a927ce0f411ec94ac26a4785f749 ./derp.txt 根据我的理解,因为它们的哈希值相同,所以其中一个derpina.txt或一个都derp.txt应该只出现。我想念什么吗?有人能启发我为什么会这样输出吗?

8
如何计算文件中文本的出现次数?
我有一个按IP地址排序的日志文件,我想查找每个唯一IP地址的出现次数。我如何用bash做到这一点?可能列出IP旁边的出现次数,例如: 5.135.134.16 count: 5 13.57.220.172: count 30 18.206.226 count:2 等等。 这是日志示例: 5.135.134.16 - - [23/Mar/2019:08:42:54 -0400] "GET /wp-login.php HTTP/1.1" 200 2988 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0" 5.135.134.16 - - [23/Mar/2019:08:42:55 -0400] "GET /wp-login.php HTTP/1.1" 200 2988 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:62.0) Gecko/20100101 Firefox/62.0" 5.135.134.16 …
19 command-line  bash  sort  uniq 

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.