How to find common values in X files that do not occur in Y files

Solution 1:

A one-liner using bash, and shell utilities sort and comm:

comm -2 -3 <(sort {1..30}.txt) <(sort {31..90}.txt)