Delete lines from file A that is in file B

后端 未结 2 1752
执念已碎
执念已碎 2021-01-25 12:29

I have two large files A and B

I need to delete lines that appear in file B from file A and save the result

to file C

I have tried comm -23 file1

2条回答
  •  独厮守ぢ
    2021-01-25 12:55

    As you mentioned, since comm needs sorted file to fetch the diff you can do in-line sorting before using comm like this :

    comm -23 <(sort file1) <(sort file2) > fileC
    

提交回复
热议问题