![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Returning a line from an input file using vbscript HI I have a list with lines, that contains an ip adress for each line. I want to make a query for a ip adress, and get the whole line as a result. I have no ideas, so I hope if someone please can help me fast ?/Catinka |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Returning a line from an input file using vbscript <charlotte.bruteig@xxxxxx> wrote in message news:831e7683-7a38-4fff-8498-d5b1788060ce@xxxxxx Quote: > HI > I have a list with lines, that contains an ip adress for each line. > I want to make a query for a ip adress, and get the whole line as a > result. > > I have no ideas, so I hope if someone please can help me fast ?> > /Catinka find "123.45.67.8" <"filename containing list.txt" >"filename for results.txt" where 123.45.67.8 is the IP address you want to retrieve, and Quote: >"filename for results.txt" |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Returning a line from an input file using vbscript <charlotte.bruteig@xxxxxx> wrote in message news:831e7683-7a38-4fff-8498-d5b1788060ce@xxxxxx Quote: > HI > I have a list with lines, that contains an ip adress for each line. > I want to make a query for a ip adress, and get the whole line as a > result. > > I have no ideas, so I hope if someone please can help me fast ?> > /Catinka @echo off type c:\List.txt | find "192.168.55.18" Fast enough? You probably need to spend a little more time in defining your requirements, in particular by stating - Where does the IP address come from? Fixed? User prompt? Some text file? - Where is the output line supposed to go to? Pop-up panel? Console screen? File? - What do you expect when the IP address is not found? The quality of the replies you get is directly related to the quality of your query. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Returning a line from an input file using vbscript On 8 Mai, 23:53, "billious" <billious_1...@xxxxxx> wrote: Quote: > <charlotte.brut...@xxxxxx> wrote in message > > news:831e7683-7a38-4fff-8498-d5b1788060ce@xxxxxx > Quote: > > HI > > I have a list with lines, that contains an ip adress for each line. > > I want to make a query for a ip adress, and get the whole line as a > > result. Quote: > > I have no ideas, so I hope if someone please can help me fast ?Quote: > > /Catinka > From the prompt, > > find "123.45.67.8" <"filename containing list.txt" >"filename for > results.txt" > > where 123.45.67.8 is the IP address you want to retrieve, and>"filename for results.txt" > > is optional - if omitted, result will be displayed on-screen. ![]() ![]() |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Returning a line from an input file using vbscript <charlotte.bruteig@xxxxxx> wrote in message news:83026766-a8d6-4f53-a996-a718a913f368@xxxxxx Quote: > On 8 Mai, 23:53, "billious" <billious_1...@xxxxxx> wrote: Quote: >> <charlotte.brut...@xxxxxx> wrote in message >> >> news:831e7683-7a38-4fff-8498-d5b1788060ce@xxxxxx >> Quote: >> > HI >> > I have a list with lines, that contains an ip adress for each line. >> > I want to make a query for a ip adress, and get the whole line as a >> > result. Quote: >> > I have no ideas, so I hope if someone please can help me fast ?Quote: >> > /Catinka >> From the prompt, >> >> find "123.45.67.8" <"filename containing list.txt" >"filename for >> results.txt" >> >> where 123.45.67.8 is the IP address you want to retrieve, and>"filename >> for results.txt" >> >> is optional - if omitted, result will be displayed on-screen. > Thanks!!! It did its work!! ![]() ![]() /Al |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Returning a line from an input file using vbscript "Pegasus [MVP]" <news@xxxxxx> wrote in message news:u%23IZXhC0JHA.5728@xxxxxx Quote: > > <charlotte.bruteig@xxxxxx> wrote in message > news:831e7683-7a38-4fff-8498-d5b1788060ce@xxxxxx Quote: >> HI >> I have a list with lines, that contains an ip adress for each line. >> I want to make a query for a ip adress, and get the whole line as a >> result. >> >> I have no ideas, so I hope if someone please can help me fast ?>> >> /Catinka > Here you go: > @echo off > type c:\List.txt | find "192.168.55.18" > > Fast enough? > > You probably need to spend a little more time in defining your > requirements, in particular by stating > - Where does the IP address come from? Fixed? User prompt? Some text file? > - Where is the output line supposed to go to? Pop-up panel? Console > screen? File? > - What do you expect when the IP address is not found? newsgroup? /Al |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Returning a line from an input file using vbscript On 9 Mai, 01:55, "Al Dunbar" <aland...@xxxxxx> wrote: Quote: > "Pegasus [MVP]" <n...@xxxxxx> wrote in message > > news:u%23IZXhC0JHA.5728@xxxxxx > > > > > > > Quote: > > <charlotte.brut...@xxxxxx> wrote in message > >news:831e7683-7a38-4fff-8498-d5b1788060ce@xxxxxx Quote: > >> HI > >> I have a list with lines, that contains an ip adress for eachline. > >> I want to make a query for a ip adress, and get the wholelineas a > >> result. Quote: Quote: > >> I have no ideas, so I hope if someone please can help me fast ?Quote: Quote: > >> /Catinka Quote: > > Here you go: > > @echo off > > type c:\List.txt | find "192.168.55.18" Quote: > > Fast enough? Quote: > > You probably need to spend a little more time in defining your > > requirements, in particular by stating > > - Where does the IP address come from? Fixed? User prompt? Some text file? > > - Where is the outputlinesupposed to go to? Pop-up panel? Console > > screen? File? > > - What do you expect when the IP address is not found? > Another question worth asking: why ask for a batch solution in avbscript > newsgroup? > > /Al Skjul sitert tekst > > Vis sitert tekst get it to work. I am thinking of just having an input box to specify the IP adress, or maybe an input file with severeal IP's And then return the hole line(s) that contains that IP. I am a newbie at scripting so if anyone has a nice example it would help me understand it. The result I want to have in an output file or only in the console. Kind Regards Torgeir |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Returning a line from an input file using vbscript On 9 Mai, 01:55, "Al Dunbar" <aland...@xxxxxx> wrote: Quote: > "Pegasus [MVP]" <n...@xxxxxx> wrote in message > > news:u%23IZXhC0JHA.5728@xxxxxx > > > > > > > Quote: > > <charlotte.brut...@xxxxxx> wrote in message > >news:831e7683-7a38-4fff-8498-d5b1788060ce@xxxxxx Quote: > >> HI > >> I have a list with lines, that contains an ip adress for eachline. > >> I want to make a query for a ip adress, and get the wholelineas a > >> result. Quote: Quote: > >> I have no ideas, so I hope if someone please can help me fast ?Quote: Quote: > >> /Catinka Quote: > > Here you go: > > @echo off > > type c:\List.txt | find "192.168.55.18" Quote: > > Fast enough? Quote: > > You probably need to spend a little more time in defining your > > requirements, in particular by stating > > - Where does the IP address come from? Fixed? User prompt? Some text file? > > - Where is the outputlinesupposed to go to? Pop-up panel? Console > > screen? File? > > - What do you expect when the IP address is not found? > Another question worth asking: why ask for a batch solution in avbscript > newsgroup? > > /Al Skjul sitert tekst > > Vis sitert tekst get it to work. I am thinking of just having an inputbox to specify the IP adress, or maybe an input file with severeal IP's And then return the hole line(s) that includes the specified IP. I am a newbie at scripting so if anyone has a nice example it would help me understand it. The result I want to have in an output file or only in the console. My IP file looks like something like this: Windows_NetServer;app.a.b.c.no;10.0.0.17 Windows_NetServer;db.a.b.c.no;10.0.0.18 Windows_NetServer;db.a.b.c.no;10.0.0.19 Windows2000_Server;app.a.b.c.no;10.0.0.20 Windows_NetServer;fil.a.b.c.no;10.0.0.21 Windows_NetServer;db.a.b.c.no;10.0.0.22 Torgeir |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Returning a line from an input file using vbscript <torgeir.schjerven@xxxxxx> wrote in message news:baee0192-0f4d-4a41-bac5-4838b88e4be2@xxxxxx On 9 Mai, 01:55, "Al Dunbar" <aland...@xxxxxx> wrote: Quote: > "Pegasus [MVP]" <n...@xxxxxx> wrote in message > get it to work. I am thinking of just having an inputbox to specify the IP adress, or maybe an input file with severeal IP's And then return the hole line(s) that includes the specified IP. I am a newbie at scripting so if anyone has a nice example it would help me understand it. The result I want to have in an output file or only in the console. My IP file looks like something like this: Windows_NetServer;app.a.b.c.no;10.0.0.17 Windows_NetServer;db.a.b.c.no;10.0.0.18 Windows_NetServer;db.a.b.c.no;10.0.0.19 Windows2000_Server;app.a.b.c.no;10.0.0.20 Windows_NetServer;fil.a.b.c.no;10.0.0.21 Windows_NetServer;db.a.b.c.no;10.0.0.22 Torgeir =============== Here you go: Set oFSO = CreateObject("Scripting.FileSystemObject") sIP = InputBox("Please enter an IP address", "Extract Address") Set oFile = oFSO.OpenTextFile("d:\IP.txt", 1) sData = oFile.ReadAll oFile.Close aData = Split(sData, VbCrLf) For Each sLine In aData If InStr(sLine, sIP) > 0 then WScript.Echo sLine Next I recommend that you download the help file script56.chm. It covers everything I used in the code above, plus lots more, plus numerous examples. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Line input perfect - mic (using same socket) V. low | Sound & Audio | |||
| Output XML to Single Line Log File using VBScript | VB Script | |||
| Past vbscript input box text to the end of url | VB Script | |||
| Input panel: Does not advance next line | Vista General | |||
| Command Line Input? | PowerShell | |||