usera Posted February 2, 2011 Share 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 Link to comment Share on other sites More sharing options...
enaiman Posted February 2, 2011 Share 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 script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
usera Posted February 2, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
usera Posted February 2, 2011 Author Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now