Windows批处理-将多个文本文件合并为一个 [英] Windows batch - concatenate multiple text files into one
问题描述
我需要创建一个脚本,该脚本将多个文本文件连接为一个. 我知道使用起来很简单
I need to create a script, which concatenates multiple text files into one. I know it's simple to use
type *.txt > merged.txt
但是要求是将同一天的文件连接成文件day_YYYY-DD-MM.txt".我是Linux用户,Windows批处理对我来说是个地狱.是Windows XP.
But the requirement is to "concatenate files from same day into file day_YYYY-DD-MM.txt" I am a Linux user and Windows batch is hell for me. It's Windows XP.
推荐答案
Windows type
命令的工作方式与UNIX cat
相似.
Windows type
command works similarly to UNIX cat
.
示例1:与文件名合并(这将合并file1.csv和file2.csv以创建concat.csv)
Example 1: Merge with file names (This will merge file1.csv & file2.csv to create concat.csv)
type file1.csv file2.csv > concat.csv
示例2:合并具有模式的文件(这将合并所有具有csv扩展名的文件并创建concat.csv)
Example 2: Merge files with pattern (This will merge all files with csv extension and create concat.csv)
type *.csv > concat_csv.txt
这篇关于Windows批处理-将多个文本文件合并为一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!