Computing.Net > Forums > Disk Operating System > Batch file to edit text file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch file to edit text file

Reply to Message Icon

Name: Alireza
Date: April 10, 2006 at 08:08:11 Pacific
OS: DOS
CPU/Ram: Pentium 4
Product: Gigabyte
Comment:

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



Sponsored Link
Ads by Google

Response Number 1
Name: franki
Date: April 10, 2006 at 10:15:48 Pacific
Reply:

Please can you inform use of the version of MS-DOS/PC-DOS etcetcetc you are using ???


0

Response Number 2
Name: Mechanix2Go
Date: April 10, 2006 at 10:50:01 Pacific
Reply:

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 off

find "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 q

debug < 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


0

Response Number 3
Name: Alireza
Date: April 10, 2006 at 23:51:46 Pacific
Reply:

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
something

I 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.


0

Response Number 4
Name: Mechanix2Go
Date: April 11, 2006 at 00:01:40 Pacific
Reply:

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



0

Response Number 5
Name: Alireza
Date: April 11, 2006 at 00:57:12 Pacific
Reply:

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.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

Strings.com v2.6 Internet on 286?



Post Locked

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


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: Batch file to edit text file

Batch file to edit text file ? www.computing.net/answers/dos/batch-file-to-edit-text-file-/16127.html

Batch file to create/edit text file www.computing.net/answers/dos/batch-file-to-createedit-text-file/9206.html

edit a blank space in text file?? www.computing.net/answers/dos/edit-a-blank-space-in-text-file/3534.html