usera 1 Posted February 2, 2011 Greeting, I have a data file "IPInfo.dat", Size about 64KB. Format as IP_Address then Hostname, between is comma, like following: 172.168.0.1,DCServer1 172.168.0.202,DNS_Server 172.168.0.27,DHCP ..... I want to have a script once I have 172.168.0.2 ready then I can use it to search and find DNS. How to do that? Thanks usera Share this post Link to post Share on other sites
enaiman 16 Posted February 2, 2011 This is the way you can get the IP address and the name - what you do with them (inside the for/next loop) is up to you. #include <File.au3> $MyFile = "your file path" Dim $MyLinesArray _FileReadToArray($MyFile, $MyLinesArray) For $i = 1 To $MyLinesArray[0] $temp = StringSplit($MyLinesArray[$i], ",") If @error Then ContinueLoop MsgBox(0, "Entries", "IP: "&$temp[1]&@CRLF&"Name: "&$temp[2]) Next SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example scriptwannabe "Unbeatable" Tic-Tac-ToePaper-Scissor-Rock ... try to beat it anyway :) Share this post Link to post Share on other sites
usera 1 Posted February 2, 2011 This is the way you can get the IP address and the name - what you do with them (inside the for/next loop) is up to you. #include <File.au3> $MyFile = "your file path" Dim $MyLinesArray _FileReadToArray($MyFile, $MyLinesArray) For $i = 1 To $MyLinesArray[0] $temp = StringSplit($MyLinesArray[$i], ",") If @error Then ContinueLoop MsgBox(0, "Entries", "IP: "&$temp[1]&@CRLF&"Name: "&$temp[2]) Next Thank you very very much! That works, the question is how can I do the search? 192.168.0.1,dns 192.168.0.2,dhcp 192.168.0.205,dcserver1 how can I use 192.168.0.2 to get dhcp? Thanks Share this post Link to post Share on other sites
usera 1 Posted February 2, 2011 Thank you very very much! That works, the question is how can I do the search?192.168.0.1,dns192.168.0.2,dhcp192.168.0.205,dcserver1how can I use 192.168.0.2 to get dhcp?ThanksThanks find the way Share this post Link to post Share on other sites