diff command to get number of different lines only

后端 未结 2 1440
长发绾君心
长发绾君心 2020-12-29 20:41

Can I use the diff command to find out if two of files differ by k lines?

I don\'t want the contextual difference, just the total number of lines that are different

2条回答
  •  时光取名叫无心
    2020-12-29 20:48

    diff can do all the first part of the job but no counting; wc -l does the rest:

    diff -y --suppress-common-lines file1 file2 | wc -l

提交回复
热议问题