标题:按条件合并文本文件
只看楼主
xinshous
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2010-2-22
结帖率:100%
已结贴  问题点数:20 回复次数:4 
按条件合并文本文件
比如文件夹内有100(编号1-100)个文本文件,如何导入条件文本根据要求分别合并这些文件
条件文本格式:
参盘名称,起始文件号,截止文件号
如:
a001,1,23
a002,3,47
a003,5,30
.........


运行后则产生a001.txt(包含1.txt至23.txt编号内的所有文件)

            a002.txt(包含3.txt至47.txt编号内的所有文件)
搜索更多相关主题的帖子: 条件 文本文件 
2010-02-24 22:44
三断笛
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:31
帖 子:1621
专家分:1617
注 册:2007-5-24
得分:14 
用DOS的COPY命令即可合并.
用批处理即可循环.

2010-02-26 17:37
xinshous
Rank: 1
等 级:新手上路
帖 子:18
专家分:0
注 册:2010-2-22
得分:0 
虽说要的不是这种结果,不过还是谢谢了
2010-02-27 09:18
xiaomarn
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:5
帖 子:348
专家分:2026
注 册:2009-3-18
得分:0 
虽然结了,不过刚好昨晚做了一个
sub ConFunc(desdination as string,startFile as integer,endFile as integer)
    dim i as integer
    dim sourcePath as string
    dim ch as string

    desdination="e:\desdination\" & desdination & ".txt"
    open desdination for append as #1
        for i=startFile to endFile
            sourcePath="e:\source\" & i & ".txt"      '存放文件根据自己情况
            open sourcePath for input as #2
                do while not eof(2)
                    ch=input(1,#2)
                    print #1,ch
                loop
            close #2
        next
    close #1
end sub      
               
   
收到的鲜花
  • sznt2010-03-02 11:10 送鲜花  5朵  
2010-03-01 12:37
sznt
Rank: 2
等 级:论坛游民
帖 子:161
专家分:20
注 册:2005-8-4
得分:0 
以下是引用xiaomarn在2010-3-1 12:37:40的发言:

虽然结了,不过刚好昨晚做了一个
sub ConFunc(desdination as string,startFile as integer,endFile as integer)
    dim i as integer
    dim sourcePath as string
    dim ch as string

    desdination="e:\de ...
谢谢,无私精神让人钦佩
2010-03-02 11:09



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-298067-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.309308 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved