join, on the other hand, seems to require some inspection. In its simplest form, it makes sense:
Each line from each file is paired and output together. But here’s where things get complicated … or at least my brain wants to follow a different track:
One file is a line longer, so
join refuses to join them, or will only join the ones that match. My logic tells me it should join them anyway, but use some sort of placeholder to show information is missing.
If I ask for an additional line with the
-a flag, I get the last line but it’s pressed to the left — and you can see how that makes it look like that line belongs to the first list. And the
-a flag seems cumbersome, since it requires me to know beforehand that one list or the other is missing data.
And finally … if the lines aren’t prefixed,
join shows nothing for its efforts. If they’re not sorted, the unsorted lines are spat out with a warning, in the center of everything else that worked. It’s a bit of a mess.
I understand how
join works and I can abide by its rules and formatting, but it seems counterintuitive to me. Perhaps if I just want corresponding lines of two different files output on the same line, there’s another tool I should consider.
For what I’ve seen,
join can do that, but it will take a little preparation from me.😕