I wanted to use comm to compare 2 lists: one consists of randomly generated words:
cat /dev/urandom | head -n 10000 | strings | tr 'A-Z' 'a-z' | sort
the other one is an english dictionary:
wget -q0- <URL> | sort
(I can't really give away the URL) I tried saving both lists to temporary files and then used comm -12 file1 file2 and it worked, but now i want to do it without creating those temporary files. Is there a way?
Your code (with the useless use of
cat
refactored) can be trivially rewritten to use a Bash process substitution:However, unless your goal is to expedite the heat death of the universe, your code looks massively inefficient. Perhaps you should explain what you are trying to accomplish? (Plus if you want to find the frequency of dictionary words in
/dev/urandom
output, I believestrings
will be filtering out any really short words.)