Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Batch file to edit text file

Original Message
Name: Alireza
Date: April 10, 2006 at 08:08:11 Pacific
Subject: Batch file to edit text file
OS: DOS
CPU/Ram: Pentium 4
Model/Manufacturer: 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


Report Offensive Message For Removal


Response Number 1
Name: franki
Date: April 10, 2006 at 10:15:48 Pacific
Subject: Batch file to edit text file
Reply: (edit)
Please can you inform use of the version of MS-DOS/PC-DOS etcetcetc you are using ???

Report Offensive Follow Up For Removal

Response Number 2
Name: Mechanix2Go
Date: April 10, 2006 at 10:50:01 Pacific
Subject: Batch file to edit text file
Reply: (edit)
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


Report Offensive Follow Up For Removal

Response Number 3
Name: Alireza
Date: April 10, 2006 at 23:51:46 Pacific
Subject: Batch file to edit text file
Reply: (edit)
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.


Report Offensive Follow Up For Removal

Response Number 4
Name: Mechanix2Go
Date: April 11, 2006 at 00:01:40 Pacific
Subject: Batch file to edit text file
Reply: (edit)
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



Report Offensive Follow Up For Removal

Response Number 5
Name: Alireza
Date: April 11, 2006 at 00:57:12 Pacific
Subject: Batch file to edit text file
Reply: (edit)
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.


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Batch file to edit text file

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




How to make a FOLDER private

ad cross domain/forest grp nestin

Recreating vista boot files?

Cisco IOS very quick question

hard drive ram


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC