Join Statement omitting entries

与世无争的帅哥 提交于 2019-12-02 07:45:58

I tried this out, and I noticed a couple things.

First: this is minor, but I think you're missing a comma in your -o specifier. I changed it to -o 1.1,2.1.

But then, running it on just the fragments you posted, I got only three lines of output:

1|1
3|3
7|7

I think this is because join assumes alphabetical sorting, while your input files look like they're numerically sorted.

Rule #1 of join(1) is to make sure your inputs are sorted, and the same way join expects them to be!

When I ran the two input files through sort and then joined again, I got 18 rows of output. (Sorting was easy, since you're joining on the first column; I didn't have to muck around with sort's column specifiers.)

Beware that, these days, sort doesn't always sort the way you expect, due to locale issues. I tend to set LC_ALL=C to make sure I get the old-fashioned behavior I'm used to.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!