在两个文件之间进行排序差异的简单方法是什么? [英] What is an easy way to do a sorted diff between two files?

查看:18
本文介绍了在两个文件之间进行排序差异的简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个文件,其中一些行的顺序发生了变化.我希望能够比较这些.

I have two files in which some of the lines have changed order. I would like to be able to compare these.

一个网站提出了如下所示的内容:

One website suggested something that looks like this:

diff <(sort text2) <(sort text1)

但这会产生错误:缺少重定向名称.

我正在使用 tcsh.上面的命令是针对不同的 shell 的吗?

I am using tcsh. Is the command above for a different shell?

有没有更好的方法?

推荐答案

此重定向语法特定于 bash.因此它在 tcsh 中不起作用.

This redirection syntax is bash specific. Thus it won't work in tcsh.

可以调用bash直接指定命令:

You can call bash and specify the command directly:

bash -c 'diff <(sort text2) <(sort text1)'

这篇关于在两个文件之间进行排序差异的简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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