How could I compare two files and remove similar rows in them (bash script)

前端 未结 3 1522
陌清茗
陌清茗 2021-01-28 05:21

I have two files of data with similar number of columns. I\'d like to save file2 in another file (file3) while I exclude the rows which are existed already in the file1.

<
3条回答
  •  -上瘾入骨i
    2021-01-28 06:18

    You can convert tabs to spaces on the fly:

    grep -vif <(tr '\t' ' ' < file1) file2 > file3
    

    This is process substitution.

提交回复
热议问题