Saturday 27 June 2009

Process substitution

"<" and ">" are used to feed the stdout of one process to stdin of other process,which is very handy in compare results of two files or two outputs..

use1) ls -l | cat can be written as cat <(ls -l)

Similarly, to see the ls result of two directories and compare..

use2) comm <(ls -l $dir1) <(ls -l $dir2)

use3) Using process substitution to compare the contents of two directories (to see which filenames are in one,but not the other

diff <(ls $first_directory) <(ls $second_directory) Note: no space between "<" and ">" and parenthesis


No comments:

Post a Comment

Tweets by @sriramperumalla