我有2个文件file1.txt和file2.txt,其数据如下 -
file1.txt中的数据
125个
125个
295个
295个
355个
355个
355
file2.txt中的数据
125个
125个
295个
355
我对文件进行了以下操作并获得了以下输出 -
Operation1-
sort file1.txt | uniq -c
2 125
2 295
3 355
Operation2-
sort file2.txt | uniq -c
2 125
1 295
1 355
现在,我希望使用Operation1和Operation2的结果跟随输出 - 我想比较Operation1和Operation2的结果并得到输出,它将显示两个文件的第1列的值的差异,并且它将显示第2列,如下所示 -
0 125
1 295
2 355
答案 0 :(得分:1)
在某些文件中重定向操作1和操作2的输出。让我们说
文件1
和
file2的
,然后这样写: -
paste file1 file2 | awk '{print $1-$3,$2}'
你将有输出
0 125
1 295
2 355