sort using a temporary file before intersect