使用Windows命令行连接文本文件,删除引导行 [英] Concatenate text files with Windows command line, dropping leading lines

查看:126
本文介绍了使用Windows命令行连接文本文件,删除引导行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要连接一些相对较大的文本文件,并且希望通过命令行执行此操作。不幸的是我只有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

允许我几乎得到我想要的,但我不想要第一行

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.

我注意到更多 + 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命令行连接文本文件,删除引导行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆