I have these two files:-
[root@localhost base_filters]# cat aix_old
joe
amadeus
image
bill
juliet
charlie
romeo
ftp
[root@localhost base_filters]# cut -d: -f1 passwd2
henry
amadeus
image
bill
julie
jennifer
charlie
romeo
harry
I am trying to find out the differences between two files; so I am using the following command:-
[root@localhost base_filters]# cut -d: -f1 passwd2 | sort | diff `sort aix_old` -
But getting this following error:
diff: extra operand `charlie'
diff: Try `diff --help' for more information.
I know I can use another temporary file for sorting the contents in aix_old
but I don't want another temporary file; so tried with command substitution.
Any idea, what I might be doing wrong.
Best Answer
With ksh, zsh or bash, using process substitution:
gives:
gives:
From the process substition wiki: http://en.wikipedia.org/wiki/Process_substitution
The same using yash's process redirection (on systems with
/dev/fd/n
):Or more cumbersomely with any Bourne-like shell (on systems with
/dev/fd/n
):