Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I have a text file, which contains some text, including "192.168.168.44" in it.
This is the IP address of a VPN connection I establish to a server, and the last number (44 for example here) changes every time I connet.I want to have a batch file, which clears everything else in the text file, except this address, and adds to it "My IP is" followed by the address.
Example: My IP is 192.168.168.44
Can anyone help me with this?
Thanx a looooooooooooooooot

If the IP is on a line by itself, try the batch below. If it isn't, things will be more complex.
::== myip.bat
@echo offfind "192.168.168" < myfile.txt > ip.txt
> m.d echo e 100 'My IP is '
>> m.d echo n my.txt
>> m.d echo rcx
>> m.d echo 9
>> m.d echo w
>> m.d echo qdebug < m.d > nul
copy /b my.txt+ip.txt newfile.txt > nul
:: DONE
If at first you don't succeed, you're about average.M2

Thank you for your replies.
Unfortunately, the IP address is not in a single line by itself. It is part of a line, like this:something
something
something
IP Address. . . . . . . . : 192.168.168.12
something
something
somethingI need to get rid of all those texts (here shown as "something", whatever they are, and what remains is only a text that says: My IP is 192.168.168.12
Thank you very very much.

We need to know the EXACT content of:
IP Address. . . . . . . . : 192.168.168.12
And the EXACT OS.
=====================================
If at first you don't succeed, you're about average.M2Go

Dear all,
Thank you for your kind help.
Unfortunately, the string "192.168.168.44" is not in a single line. It is part of a line, which also includes other stuff as well.

![]() |
Strings.com v2.6
|
Internet on 286?
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |