compare two files in UNIX

前端 未结 4 985
南笙
南笙 2020-12-13 10:21

I would like to compare two files [ unsorted ] file1 and file2. I would like to do file2 - file1 [ the difference ] irrespective of the line number? diff is not working.

4条回答
  •  不思量自难忘°
    2020-12-13 10:55

    There are 3 basic commands to compare files in unix:

    1. cmp : This command is used to compare two files byte by byte and as any mismatch occurs,it echoes it on the screen.if no mismatch occurs i gives no response. syntax:$cmp file1 file2.

    2. comm : This command is used to find out the records available in one but not in another

    3. diff

提交回复
热议问题