问题描述
我需要连接一些相对较大的文本文件,并且更愿意通过命令行执行此操作.不幸的是,我只有 Windows,无法安装新软件.
I need to concatenate some relatively large text files, and would prefer to do this via the command line. Unfortunately I only have Windows, and cannot install new software.
type file1.txt file2.txt > out.txt
让我几乎可以得到我想要的东西,但我不希望将 file2.txt 的第一行包含在 out.txt 中.
allows me to almost get what I want, but I don't want the 1st line of file2.txt to be included in out.txt.
我注意到 more
有 +n
选项来指定起始行,但我还没有设法组合这些以获得我想要的结果.我知道这在 Windows 中可能是不可能的,我总是可以手动编辑 out.txt 以摆脱该行,但是有没有一种从命令行执行此操作的简单方法?
I have noticed that more
has the +n
option to specify a starting line, but I haven't managed to combine these to get the result I want. I'm aware that this may not be possible in Windows, and I can always edit out.txt by hand to get rid of the line, but is there a simple way of doing it from the command line?
推荐答案
more +2 file2.txt > temp
type temp file1.txt > out.txt
或者你可以使用copy
.参见 copy/?
了解更多.
or you can use copy
. See copy /?
for more.
copy /b temp+file1.txt out.txt
这篇关于使用 Windows 命令行连接文本文件,删除前导行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!