I'm trying to compute the difference between the output of two awk commands but my simple attempts at it seem to be failing. Here is what I'm trying:diff $(awk '{print $3}' f1.txt | sort -u) $(awk '{print $2}' f2.txt | sort -u)This doesn't work for reasons unknown to me. I was under the assumption that $() construct was used to capture the output of another command but my diff invocation fails to recognize the two inputs given to it. Is there any way I can make this work.By the way, I can't use the obvious solution of writing the output of those two commands to separate files given that I'm logged on to a production box with no 'write' privileges.
Diff the output of two `awk` commands
shell;io redirection;awk;diff
diff expects the names of two files, so you should put the two output on two files, then compare them:awk '{print $3}' f1.txt | sort -u > out1awk '{print $2}' f2.txt | sort -u > out2diff out1 out2or, using ksh93, bash or zsh, you can fool diff with the command:diff <(awk '{print $3}' f1.txt | sort -u) <(awk '{print $2}' f2.txt | sort -u)