如何将两个文件彼此排成一列,但分别省略最后一行/第一行? [英] How to cat two files after each other but omit the last/first line respectively?

查看:73
本文介绍了如何将两个文件彼此排成一列,但分别省略最后一行/第一行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把两个文件放在一起.但是,应该省略第一个文件的最后一行和最后一个文件的第一行.

I have two files I want to cat together. However, the last line of the first file and the first line of the last file should be omitted.

我确信这可以在UNIX shell(或Cygwin)中完成.但是如何?

I am sure this can be done in a UNIX shell (or rather, Cygwin). But how?

推荐答案

$ head --lines=-1 file1 > res
$ tail --lines=+2 file2 >> res

这篇关于如何将两个文件彼此排成一列,但分别省略最后一行/第一行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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