difference between the content of two files

后端 未结 4 1192
南笙
南笙 2020-12-06 02:58

I have two files one file subset of other and i want to obtain a file which has contents not common to both.for example

File1

apple
         


        
4条回答
  •  时光取名叫无心
    2020-12-06 03:06

    use awk, no sorting necessary (reduce overheads)

    $ awk 'FNR==NR{f[$1];next}(!($1 in f)) ' file2 file
    mango
    orange
    jackfruit
    grapes
    okra
    

提交回复
热议问题