I'd like to use unix's comm
command to compare different results from redis
.
Redis outputs will be strings separated by new lines, for example:
# redis-cli smembers set_1
1) "term 1"
2) "term 2"
3) "term 3"
#redis-cli smembers set_2
1) "term 2"
2) "term 4"
so I was trying something like:
comm -12 <(sort redis-cli smembers "set_1") <(sort redis-cli smembers "set_2")
But there's clearly something wrong here, I think this sort command only works with actual files, not outputs.
So is it possible to use comm
to sort the output of redis?
Yes,
sort
would expect filenames as arguments (in addition to sort options).You can say:
Note that depending upon the desired sorting for the output of
redis-cli ...
, you might want to pass arguments tosort
. Options such as-k
,-s
,-t
might help.