怎样的diff两个文件的顶部线条,没有中间文件 [英] How to diff top lines of two files without intermediate file

查看:136
本文介绍了怎样的diff两个文件的顶部线条,没有中间文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个大文件,我要为每个文件的顶部线之间的差异,但我不希望使用中间文件。我愿做这样的事情:

I have 2 big files and I want to make a diff between the top lines of each files, but i don't want to use intermediate files. I would like to do something like that :

diff `head -n 2000 file1.log` `head -n 2000 file2.log`

我记得我做类似的东西很久以前,即得。作出这样头一个命令-n 2000 file1.log PTED作为文件间$ P $。但我不记得如何。也许是另一个shell ...结果
谢谢你。

I remember I've done something like that a long time ago, ie. make a command like head -n 2000 file1.log interpreted as a file. But I don't remember how. Maybe it was another shell...
Thank you.

推荐答案

你可能在想的在bash进程替换。例如,尝试:

You're probably thinking of process substitution in bash. For example, try:

 diff <(head -n 2000 file1.log) <(head -n 2000 file2.log)

这篇关于怎样的diff两个文件的顶部线条,没有中间文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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