7
5
I have two files in a Linux / Bash environment:
# Example data
$ cat abc
2 a
1 b
3 c
$ cat bcd
5 c
2 b
1 d
I'm trying to join the two files on the first column. The following does not work because the input files must be sorted on the match field.
# Wrong: join on unsorted input does not work
$ join abc bcd
I can get around this by creating two temp files and joining them
$ sort abc > temp1
$ sort bcd > temp2
$ join temp1 temp2
1 b d
2 a b
But is there a way to do this without creating temp files?