You're replying to a comment by Wenslayer.

Wenslayer Permalink
February 03, 2012, 19:21

Here's my take on power set without resorting to a scripting language:

(echo -e "echo \c"; for set in set1 set2 set3; do echo -e "{`sort -u $set|xargs|tr ' ' ','`,}\c"; done)|bash -|xargs -n1

For example, here are three files representing different sets:

$ head set*
==> set1 <==
a
b
==> set2 <==
m
n
==> set3 <==
x
y

And here's the power set of them:

$ (echo -e "echo \c"; for set in set1 set2 set3; do echo -e "{`sort -u $set|xargs|tr ' ' ','`,}\c"; done) | bash -s | xargs -n1
a
am
amx
amy
an
anx
any
ax
ay
b
bm
bmx
bmy
bn
bnx
bny
bx
by
m
mx
my
n
nx
ny
x
y

Cheers!

Reply To This Comment

(why do I need your e-mail?)

(Your twitter name, if you have one. (I'm @pkrumins, btw.))

Type the first letter of your name: (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.