I have 2 text files. Lets name them file1.txt and file2.txt
file1.txt is as follows
chr10 181144 225933 chr10 181243 225933 chr10 181500 225933 chr10 226069 255828 chr10 255989 267134 chr10 255989 282777 chr10 267297 282777 chr10 282856 283524 chr10 283618 285377 chr10 285466 285995 file2.txt is as follows
chr10 181144 225933 chr10 181243 225933 chr10 181500 225933 chr10 255989 282777 chr10 267297 282777 chr10 282856 283524 chr10 375542 387138 chr10 386930 387138 chr10 387270 390748 chr10 390859 390938 chr10 391051 394580 chr10 394703 395270 What I want to output in a single file is
- All the common lines between file1 and file2
- All the lines which are in file1 but are not common to both
- All the lines which are in file2 but are not common to both.
I wrote a Perl script to do this but I am pretty sure there must be a command line or an easier way to do it.
comm.sort -u file1.txt file2.txtis the obvious answer here unless you want the lines in the output to be in that particular order...