#!/bin/bash a=`cat nowcoder.txt | grep 3306 | awk '{print $5}' | awk -F ':' '{print $1}' | sort | uniq -c | awk 'BEGIN{sum=0;}{sum=sum+$1;}END{print sum}'` b=`cat nowcoder.txt | grep 3306 | awk '{print $5}' | awk -F ':' '{print $1}' | sort | uniq -c | wc -l` echo "TOTAL_IP $b" echo "ESTABLISHED $a" echo "TOTAL_LINK $a"