Jump to content

Recommended Posts

Posted

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

Posted

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 :)

Posted

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

Posted

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

Thanks find the way

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...