Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shell 查找两个文件之间的差异_Shell_Unix - Fatal编程技术网

Shell 查找两个文件之间的差异

Shell 查找两个文件之间的差异,shell,unix,Shell,Unix,我想找出两个文件之间的差异,只打印唯一的行 我尝试了uniq-u,它不起作用 diff test.sh test1.sh > test.txt sort test.txt | uniq -u > test1.txt 我还能做什么呢?IMO对shell脚本行进行排序没有任何意义。IMO对shell脚本行进行排序没有任何意义。sort12 | uniq-uuoocsort12 | uniq-uuooc > cat 1 1 2 3 4 > cat 2 2 3 4 5 >

我想找出两个文件之间的差异,只打印唯一的行

我尝试了
uniq-u
,它不起作用

diff test.sh  test1.sh > test.txt
sort test.txt | uniq -u > test1.txt

我还能做什么呢?

IMO对shell脚本行进行排序没有任何意义。IMO对shell脚本行进行排序没有任何意义。
sort12 | uniq-u
uooc
sort12 | uniq-u
uooc
> cat 1
1
2
3
4
> cat 2
2
3
4
5
> cat 1 2 | sort | uniq -u
1
5