FILE="user_name"
TMPFILE="_new_user_name"
OUTFILE="kad_node_list"

#echo "" > $TMPFILE


exec 3<&0
exec 0<$FILE

while read line
do
   echo $line
   host=`echo $line | cut -d " " -f 2`;
   port=`echo $line | cut -d " " -f 4`;
#   echo "$host:$port"
   ../src/checker -k -a $host -p $port | grep "200 Ok" >> /dev/null
   result=$?
   if [ $result == 0 ];then
    echo $line >> $TMPFILE 
   fi
done

sort -k2 < $TMPFILE > $OUTFILE

rm -f $TMPFILE