Extract unique IPs from live tcpdump capture

后端 未结 3 879
礼貌的吻别
礼貌的吻别 2021-02-10 16:47

I am using the following command to output IPs from live tcpdump capture

sudo tcpdump -nn -q ip -l | awk \'{print $3; fflush(stdout)}\' >> ips.txt
<         


        
3条回答
  •  半阙折子戏
    2021-02-10 17:22

    While I'm a huge Awk fan, it's worthwhile having alternatives. Consider this example using cut:

      tcpdump -n ip | cut -d ' ' -f 3 | cut -d '.' -f 1-4 | sort | uniq
    

提交回复
热议问题