[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文本处理] 批处理如何从txt文本读取内容并按指定格式和要求生成xml文件?

本帖最后由 pcl_test 于 2016-4-21 19:45 编辑

批处理 如何生成预期的xml文件,求助!

xml文件模板如下:
<?xml version="1.0" encoding="UTF-8"?>
<DeviceList>
    <device mac="AA:AA:AA:AA:AA:AA">
        <terminal mac="CC:CC:CC:00:00:00" mode="2" sendpackagespeed="13000000" cumulativeTraffic="6552146115" hostname="test01" />
        <terminal mac="CC:CC:CC:00:00:01" mode="2" sendpackagespeed="13000000" cumulativeTraffic="3146115" hostname="test02" />
        <terminal mac="CC:CC:CC:00:00:02" mode="2" sendpackagespeed="13000000" cumulativeTraffic="3146115" hostname="test03" />
        <terminal mac="CC:CC:CC:00:00:03" mode="2" sendpackagespeed="13000000" cumulativeTraffic="3146115" hostname="test04" />
        <terminal mac="CC:CC:CC:00:00:04" mode="2" sendpackagespeed="13000000" cumulativeTraffic="3146115" hostname="test05" />
        <terminal mac="CC:CC:CC:00:00:05" mode="2" sendpackagespeed="10000000" cumulativeTraffic="3146115" hostname="test06" />
        <terminal mac="CC:CC:CC:00:00:06" mode="2" sendpackagespeed="10000000" cumulativeTraffic="3146115" hostname="test07" />
        <terminal mac="CC:CC:CC:00:00:07" mode="2" sendpackagespeed="10000000" cumulativeTraffic="3146115" hostname="test08" />
        <terminal mac="CC:CC:CC:00:00:08" mode="2" sendpackagespeed="10000000" cumulativeTraffic="3146115" hostname="test09" />
        <terminal mac="CC:CC:CC:00:00:09" mode="2" sendpackagespeed="10000000" cumulativeTraffic="3146115" hostname="test10" />
    </device>
    <device mac="AA:AA:AA:AA:AA:AA">
        <terminal mac="CC:CC:CC:00:00:00" mode="0" sendpackagespeed="6000000" cumulativeTraffic="6552146115" hostname="test01" />
        <terminal mac="CC:CC:CC:00:00:01" mode="0" sendpackagespeed="6000000" cumulativeTraffic="3146115" hostname="test02" />
        <terminal mac="CC:CC:CC:00:00:02" mode="0" sendpackagespeed="6000000" cumulativeTraffic="3146115" hostname="test03" />
        <terminal mac="CC:CC:CC:00:00:03" mode="0" sendpackagespeed="6000000" cumulativeTraffic="3146115" hostname="test04" />
        <terminal mac="CC:CC:CC:00:00:04" mode="0" sendpackagespeed="6000000" cumulativeTraffic="3146115" hostname="test05" />
        <terminal mac="CC:CC:CC:00:00:05" mode="0" sendpackagespeed="4000000" cumulativeTraffic="3146115" hostname="test06" />
        <terminal mac="CC:CC:CC:00:00:06" mode="0" sendpackagespeed="4000000" cumulativeTraffic="3146115" hostname="test07" />
        <terminal mac="CC:CC:CC:00:00:07" mode="0" sendpackagespeed="4000000" cumulativeTraffic="3146115" hostname="test08" />
        <terminal mac="CC:CC:CC:00:00:08" mode="0" sendpackagespeed="4000000" cumulativeTraffic="3146115" hostname="test09" />
        <terminal mac="CC:CC:CC:00:00:09" mode="0" sendpackagespeed="4000000" cumulativeTraffic="3146115" hostname="test10" />
    </device>
</DeviceList>
需要的xml文件里共有30000个device mac,每一个device mac下有10个terminal mac,device mac值从一个存有30000个mac地址的txt文件中依次获取,每个device mac下的10个terminal mac地址要求不能重复,请大神给予帮助,感谢万分!!!

30000个mac地址的txt文件如下:
...
BB:BB:BB:00:00:00
BB:BB:BB:00:00:01
BB:BB:BB:00:00:02
BB:BB:BB:00:00:03
BB:BB:BB:00:00:04
BB:BB:BB:00:00:05
BB:BB:BB:00:00:06
BB:BB:BB:00:00:07
BB:BB:BB:00:00:08
BB:BB:BB:00:00:09
BB:BB:BB:00:00:10
...
1

评分人数

返回列表