Linux join utility complains about input file not being sorted

前端 未结 3 2029
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-03 01:35

I have two files:

file1 has the format:

field1;field2;field3;field4

(file1 is initially unsorted)

file2 has the format:

3条回答
  •  庸人自扰
    2021-01-03 02:07

    sort -k1 uses all fields starting from field 1 as the key. You need to specify a stop field.

    sort -t\; -k1,1
    

提交回复
热议问题