sort --merge --unique fileA fileB > output #### zcat fileA.gz fileB.gz | sort --merge --uniq --compress-prog= gzip | gzip > output.gz