I can use this command
join -1 x -2 y file1 file2
to join 2 files on the xth column of file1 and the yth column of file2.
But is there a way to only retrieve certain columns from file1 and file2 and to order these columns in the new file
e.g. file 1 has cols 1 2 3 and file 2 has cols 1 2 3 4
I want to join on col1 in both files and retrieve all cols from file 1 and only col 4 from file 2
in this example cols 1 2 3 are the same in both files so i am effectively merging them to add col4 but I have more complicated examples than this where the 2 files only have a couple of columns in common and I want to merge them into a unifed file containing one copy of each column