|
|
|
Batch file to edit text file ?
|
Original Message
|
Name: MikeAtVillage
Date: April 18, 2006 at 05:03:04 Pacific
Subject: Batch file to edit text file ?OS: MS-DOS-6.22CPU/Ram: more than enoughModel/Manufacturer: Bitsa |
Comment: Hi, I'm looking for a simple batch file which will edit "protocol.ini" (see below) for me and replace one number with another. I want to be able to replace the last segment of the line "IPAddr=[172.16.15.201]" that is, I want to replace the 201 with some other 3 digit number. A batch file which would accept a parameter would be great e.g C:\file.bat 202 would find and replace the 201 with 202. (it will always start off as 201). Thanks
Mike Protocol.ini....
[network.setup] version=0x3100 netcard=NIC,1,NIC transport=nts$ntst2,NTS$NTST2 transport=ibm$netbeui,IBM$NETBEUI lana0=NIC,1,ibm$netbeui lana1=NIC,1,nts$ntst2 [NTS$NTST2] DefaultDomain=ptstaff DNSaddr=[172.16.1.12] GatewayAddr=[172.16.15.1] NetSubNetMask=[255.255.255.0] IPAddr=[172.16.15.201] DriverName=ntsts$ VCs=16 VCReceiveLarge=6 VCSends=6 RcvWindow=2920 UseMemory=UMB BINDINGS=NIC LANABASE=1 [protman] DriverName=PROTMAN$ PRIORITY=ibm$netbeui [IBM$NETBEUI] DriverName=netbeui$ SESSIONS=20 NCBS=20 BINDINGS=NIC LANABASE=0 [nic] drivername = E100B$
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Mechanix2Go
Date: April 18, 2006 at 05:40:11 Pacific
|
Reply: (edit)Hi Mike, Getting it done with DOS 6.22 tools will be pretty hard going. If you can accept a 3rd party util, get Change
Use this one line BAT: change Protocol.ini "172.16.15.201" "172.16.15.%1"
===================================== If at first you don't succeed, you're about average.M2Go
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
|
Reply: (edit)Thanks again M2Go, it's perfect. I've downloaded change.com and incorporated it into a 2 line batch file (tweak.bat) so it will tweak the IP address in protocol.ini and the computername in network.ini when given a parameter. C:\tweak 202 change net\protocol.ini "201" "%1" change net\network.ini "computername=images" "computername=images%1" -
Report Offensive Follow Up For Removal
|
|
Response Number 4
|
Name: Mechanix2Go
Date: April 19, 2006 at 03:09:08 Pacific
|
Reply: (edit)Hi Mike, Looks like you got the hang of it pretty quick. For future use, keep in mind that your first line will replace EVERY instance of 201, which is not an issue with this protocol.inf but could be with other files, if they happened to contain something like: dns=201.x.x.x ===================================== If at first you don't succeed, you're about average.M2Go
Report Offensive Follow Up For Removal
|
|
Response Number 5
|
|
Reply: (edit)Thanks again M2Go. I carefully checked the contents of protocol.ini and network.ini before I ran the batch file, just in case there were other entries which would change :-) I'm sure I'm going to find many other uses for change.com, a very handy little prog. ATB Mike
Report Offensive Follow Up For Removal
|
|
Response Number 6
|
Name: Frenchie418
Date: May 15, 2006 at 12:31:06 Pacific
|
Reply: (edit)Hi, I have just downloaded the Change.com program and I'm looking for more info. I have a CSV file where two of my columns have the same name. I would like to use the program so that every week when the CSV is downloaded, change would open the file and chane the name of only one of the two columns. Can it be done and how? Thanks for your help.
Report Offensive Follow Up For Removal
|
|
Response Number 7
|
Name: Mechanix2Go
Date: May 15, 2006 at 16:33:49 Pacific
|
Reply: (edit)Hi Frenchie, Paste in the exact [I assume first row] text and we'll checkit it out. Be aware that CHANGE.COM is limited to files of up to about 30KB. If at first you don't succeed, you're about average.M2
Report Offensive Follow Up For Removal
|
Use following form to reply to current message:
|
|

|