ÇóÖúÀ² ºÇºÇ ÈçºÎͳ¼ÆÎļþÖÐÖØ¸´ÐÅÏ¢£¿
Ïëͳ¼ÆÒ»ÏÂÎļþÖÐÖØ¸´µÄIP£¬Èç¹ûÔÚÎļþÖгöÏÖÒ»´Î£¬Ôò²»ÏÔʾ£¬Èç¹û¸ÃIPÖØ¸´³öÏÖÔòÆÁÄ»ÏÔʾ¸ÃIP ÎļþÈçÏÂ10.9.230.86.1
10.9.238.94.1
10.9.211.105.1
10.9.237.72.1
10.9.230.92.1
10.9.235.202.1
10.9.216.87.1
10.9.225.117.1
10.9.245.105.1
10.9.243.103.1
10.9.228.102.1
10.8.112.30.1
10.8.113.79.1
10.8.113.74.1
10.9.228.120.1
10.9.222.95.1
10.6.109.3.1
10.9.201.76.1
10.9.201.65.1
10.9.210.105.1
10.7.200.133.1
10.9.198.121.1
10.9.230.86.1
10.9.217.125.1 [code]
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[765 0][/color] [color=red]; cat file
[/color]IP1
IP2
IP3
IP2
IP3
IP3
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[765 0][/color] [color=red]; sort file | uniq -d
[/color]IP2
IP3
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[765 0][/color] [color=red]; o
[/color][/code] ÊÕµ½ ллÀ² ºÜºÃÓà linuxÃüÁîÌ«¶àÁË£¬Ô½¿´Ô½¶à ºÇºÇ [code]
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[764 0][/color] [color=red]; cat file
[/color]IP1
IP2
IP3
IP2
IP3
IP3
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[764 0][/color] [color=red]; awk '{ ++a[$1] } END { for (i in a) { if (a[i] > 1) { print i }}}' file
[/color]IP2
IP3
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[764 0][/color] [color=red]; o
[/color][/code] Óà awk ÄǸöЧÂʸßЩ:
[code]
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[764 0][/color] [color=red]; cat file
[/color]10.9.230.86.1
10.9.238.94.1
10.9.211.105.1
10.9.237.72.1
10.9.230.92.1
10.9.235.202.1
10.9.216.87.1
10.9.225.117.1
10.9.245.105.1
10.9.243.103.1
10.9.228.102.1
10.8.112.30.1
10.8.113.79.1
10.8.113.74.1
10.9.228.120.1
10.9.222.95.1
10.6.109.3.1
10.9.201.76.1
10.9.201.65.1
10.9.210.105.1
10.7.200.133.1
10.9.198.121.1
10.9.230.86.1
10.9.217.125.1
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[764 0][/color] [color=red]; time sort file | uniq -d
[/color]10.9.230.86.1
real 0m0.021s
user 0m0.012s
sys 0m0.008s
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[764 0][/color] [color=red]; time awk '{ ++a[$1] } END { for (i in a) { if (a[i] - 1) { print i }}}' file
[/color]10.9.230.86.1
real 0m0.011s
user 0m0.004s
sys 0m0.008s
[color=blue]-(dearvoid@LinuxEden:tty3)-(~/tmp)-
[764 0][/color] [color=red]; o
[/color][/code]
Ò³:
[1]