一些背景知识:
主文件将保存在今天的日期,Q作为名称保存。(010913Q)
data1.text:
XYZ Company's Name Date:31082013
Sam81211..............
John71511..............
Bob61511..............
Total ................................
data2.text:
XYZ Company's Name Date:31082013
Billy71410..............
Sara9811..............
Joey6210..............
Total ................................
data3.text:
XYZ Company's Name Date:31082013
Hank3509..............
Sally42811..............
Gina1211..............
Total ................................
Master File.Text
XYZ Company's Name Date:31082013 <--- HEADER
Sam81211
John71511
Bob61511
Billy71410
Sara9811
Joey6210
Hank3509
Sally42811
Gina1211
SAVED AS 010913Q in the same folder.
答案 0 :(得分:0)
copy data1.text 010913Q
<data2.text>>010913Q more +1
<data3.text>>010913Q more +1
答案 1 :(得分:0)
这使用了Endoro的想法。
编辑我添加了一行显示文件处理顺序并更正了最终文件名。
它适用于此并提供:
XYZ Company's Name Date:31082013
Sam81211..............
John71511..............
Bob61511..............
Billy71410..............
Sara9811..............
Joey6210..............
Hank3509..............
Sally42811..............
Gina1211..............
这是基本相同的代码 - 您的文件名按字母字符排序,需要采用可排序的格式,因为这将确定首先处理哪个文件,等等。
@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set "dt=%%a"
set "YYYY=%dt:~0,4%"
set "MM=%dt:~4,2%"
set "DD=%dt:~6,2%"
set "HH=%dt:~8,2%"
set "Min=%dt:~10,2%"
set "Sec=%dt:~12,2%"
set name=tmp.tmp
set "flag="
for %%a in (*.text) do (
echo processing "%%a"
if not defined flag (
copy "%%a" "%name%" >nul
set flag=1
) else (
more +1 "%%a" >>"%name%"
)
)
findstr /v "^Total" < "%name%" >"%mm%%dd%%yyyy:~2%Q"
del "%name%"