![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-12 01:40 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS批处理 & 脚本技术(批处理室) » Question about using a batch file to modify file contents [Solved] |
| Printable Version 977 / 1 |
| Floor1 w61655 | Posted 2010-09-19 12:18 |
| 新手上路 Posts 2 Credits 2 | |
|
Original structure of file a.ini:
<p1:Item> <p1:Key>CBP_514_SMDB</p1:Key> <p1:Type>Database</p1:Type> <p1:Database> <p1:Type>SMDB</p1:Type> <p1:SMDB> <p1:Host>10.71.110.175</p1:Host> <p1:Protocol>TELNET</p1:Protocol> <p1:Port>23</p1:Port> <p1:UID>smdb13</p1:UID> <p1:PWD>bGu7HJLDe7ib5QI0WJia2g==</p1:PWD> <p1:SysomcUID/> <p1:SysomcPWD>qmrOF5nY34i8yYrXmljISQ==</p1:SysomcPWD> </p1:SMDB> </p1:Database> </p1:Item> Target structure: <p1:Item> <p1:Key>CBP_514_SMDB</p1:Key> <p1:Type>Database</p1:Type> <p1:Database> <p1:Type>SMDB</p1:Type> <p1:SMDB> <p1:Host>10.71.110.175</p1:Host> <p1:Protocol>TELNET</p1:Protocol> <p1:Port>23</p1:Port> <p1:Protocol2>FTP</p1:Protocol2> <p1:Port2>21</p1:Port2> <p1:UID>smdb13</p1:UID> <p1:PWD>bGu7HJLDe7ib5QI0WJia2g==</p1:PWD> <p1:SysomcUID/> <p1:SysomcPWD>qmrOF5nY34i8yYrXmljISQ==</p1:SysomcPWD> </p1:SMDB> </p1:Database> </p1:Item> That is, add the following two lines: <p1:Protocol2>FTP</p1:Protocol2> <p1:Port2>21</p1:Port2> Conditions for adding them: There are many item entries with this kind of structure in a.ini. Only entries whose <p1:Type> is SMDB should get them added. If those two lines already exist in the item itself, then they do not need to be added either. Many thanks [ Last edited by w61655 on 2010-9-20 at 09:47 ] |
|
| Floor2 w61655 | Posted 2010-09-20 09:45 |
| 新手上路 Posts 2 Credits 2 | |
|
Use gawk to do it,
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |