Guest User

Untitled

a guest
Mar 14th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. user="zabbix"
  2. password="LcnzJDaSR"
  3. query="select host,ip from hosts where host like 'Client%' and ip like '192.168.230.%' ORDER BY ip"
  4. sql=`mysql --host="localhost" --database="zabbix" --user="zabbix" --password="LcnzJqqXBVvPDaSR" -e "$query"`
  5.  
  6. echo "${sql}" | sed 's/\t/;/g' | sed '1,1d' > /tmp/sql
  7. IFS=";"
  8. while read login ip; do
  9. echo "lastlogin: $login"
  10. echo "lastip: $ip"
  11. done < /tmp/sql
  12.  
  13. #l=`cat ip_cl02.txt | awk '{print($3)}'`
  14.  
  15. while read line; do
  16. echo $line | awk '{print($3)}'
  17. done < ip_cl02.txt
Add Comment
Please, Sign In to add comment