奇妙な問題:接続:ファイル2がソート順ではありません。

奇妙な問題:接続:ファイル2がソート順ではありません。
sort flash_int_list.txt|join finish_comm - > t1
join: file 2 is not in sorted order

flahs_int_list.txtをソートしましたが、まだファイル2がソートされた順序ではないとマークされています。何が間違っていますか?

flash_int_list.txtは次のとおりです(最初の2行だけが表示され、約1000行あります)。

1     8cvGIKL7C-M   1  1         1         0    0    0    0  -28
9     27ugSKW4-QQ   1  3         3         0    0    0    0  -28

ベストアンサー1

残念ながら、マニュアルページはこれがうまくsort <no options> | join <no options>いかないことを示しています。

   Important: FILE1 and FILE2 must be sorted on the join fields.  E.g.,
   use ` sort -k 1b,1 ' if `join' has no options, or use ` join -t '' ' if
   `sort' has no options.

したがって、次のことを試すことができます。

sort flash_int_list.txt | join -t '' finish_comm - > t1

または:

sort -k 1b,1 flash_int_list.txt | join finish_comm - > t1

おすすめ記事