find the intersection of 4 files
<p>How do you find intersection of 4 files?</p>

<p>I used <code>grep -Fx -f 1.txt 2.txt 3.txt 4.txt</code>, but it seems that it only works for 2 files. Similarly <code>comm -12 1.txt 2.txt</code> can't be expanded to 4 files and requires data to be sorted. My data isn't sorted, in fact, it shouldn't be. I am on Mac.</p>

<p>Input:</p>

<pre><code>1.txt
.css
.haha
.hehe
2.txt
.ajkad
.shdja
.hehe

3.txt
.css1
.aaaaa
.hehe

4.txt
.qwqw
.kkkmsm
.hehe
</code></pre>

<p>Output: <code>.hehe</code></p>

<p>I used grep first on 1 and 2 stored in 12.txt, than on 3 and 4,stored in 34.txt then used grep again on 12.txt and 34.txt. But there must be a better way of doing this.</p>