Pipe two different exits to a team that accepts two inputs

It seems like it should be pretty easy, but I'm not interested in how to do this. I have two files, and I want to split their first columns (this is an example, I'm sure there are other ways to do this). So I could do cut -d, -f1 file1 > tmp1, cut -d, -f1 file2 > tmp2and then diff tmp1 tmp2. But I want to do this without using tmp files.

An example of what I expect will be ((cut -d, -f1 file1), (cut -d, -f1 file2)) > diff, but this is not real code.

Is there any way to do this?

+4
source share
2 answers

Good news! You can use process overriding in bash:

diff <(cut -d, -f1 file1) <(cut -d, -f1 file2)
+7
source

:

cut -d, -f1 file1 | diff - <(cut -d, -f1 file2)
+1

Source: https://habr.com/ru/post/1529061/


All Articles