当前位置: 技术问答>linux和unix
diff命令的问题
来源: 互联网 发布时间:2016-10-29
本文导语: 现有两个文件 a ,b a中内容为: BSC941535.98.201010241400.287038##/home/mos5200/yeliang/NOKIA 08:25 657 BSC941535.98.201010241500.288850##/home/mos5200/yeliang/NOKIA 08:25 660 BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660 BSC941535.98.2010102...
现有两个文件 a ,b
a中内容为:
BSC941535.98.201010241400.287038##/home/mos5200/yeliang/NOKIA 08:25 657
BSC941535.98.201010241500.288850##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010242300.301319##/home/mos5200/yeliang/NOKIA 08:25 658
BSC941535.98.201010250200.305522##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250300.306964##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250400.308513##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250500.310045##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250600.311543##/home/mos5200/yeliang/NOKIA 08:25 659
b中内容为:
BSC941535.98.201010241400.287038##/home/mos5200/yeliang/NOKIA 08:25 657
BSC941535.98.201010242300.301319##/home/mos5200/yeliang/NOKIA 08:25 658
BSC941535.98.201010250200.305522##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250300.306964##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250400.308513##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250500.310045##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250600.311543##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010241500.288850##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241700.292190##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250100.303949##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250700.313032##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250800.314910##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250900.316100##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241800.293259##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010241900.294751##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010242000.296252##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010242100.297775##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010242200.299337##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010250000.302477##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.97.201010250400.308481##/home/mos5200/yeliang/NOKIA 08:25 339042
BSC941535.97.201010250500.310059##/home/mos5200/yeliang/NOKIA 08:25 342204
BSC941535.97.201010250600.311541##/home/mos5200/yeliang/NOKIA 08:25 347133
BSC941535.97.201010250300.306962##/home/mos5200/yeliang/NOKIA 08:25 353222
BSC941535.97.201010250200.305521##/home/mos5200/yeliang/NOKIA 08:25 356565
BSC941535.97.201010250700.313030##/home/mos5200/yeliang/NOKIA 08:25 361153
BSC941535.97.201010250800.314577##/home/mos5200/yeliang/NOKIA 08:25 375376
BSC941535.97.201010250900.316098##/home/mos5200/yeliang/NOKIA 08:25 378543
其中两个文件中均含有
BSC941535.98.201010241500.288850##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
使用diff 命令后,这两个文件是作为不同的记录出现的,即:
2,3d1
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010241700.292190##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250100.303949##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250700.313032##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250800.314910##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250900.316100##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010241800.293259##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010241900.294751##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010242000.296252##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010242100.297775##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010242200.299337##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010250000.302477##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.97.201010250400.308481##/home/mos5200/yeliang/NOKIA 08:25 339042
> BSC941535.97.201010250500.310059##/home/mos5200/yeliang/NOKIA 08:25 342204
> BSC941535.97.201010250600.311541##/home/mos5200/yeliang/NOKIA 08:25 347133
> BSC941535.97.201010250300.306962##/home/mos5200/yeliang/NOKIA 08:25 353222
> BSC941535.97.201010250200.305521##/home/mos5200/yeliang/NOKIA 08:25 356565
> BSC941535.97.201010250700.313030##/home/mos5200/yeliang/NOKIA 08:25 361153
> BSC941535.97.201010250800.314577##/home/mos5200/yeliang/NOKIA 08:25 375376
> BSC941535.97.201010250900.316098##/home/mos5200/yeliang/NOKIA 08:25 378543
明显不对 可是不知道为什么 哪位帮帮忙
a中内容为:
BSC941535.98.201010241400.287038##/home/mos5200/yeliang/NOKIA 08:25 657
BSC941535.98.201010241500.288850##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010242300.301319##/home/mos5200/yeliang/NOKIA 08:25 658
BSC941535.98.201010250200.305522##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250300.306964##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250400.308513##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250500.310045##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250600.311543##/home/mos5200/yeliang/NOKIA 08:25 659
b中内容为:
BSC941535.98.201010241400.287038##/home/mos5200/yeliang/NOKIA 08:25 657
BSC941535.98.201010242300.301319##/home/mos5200/yeliang/NOKIA 08:25 658
BSC941535.98.201010250200.305522##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250300.306964##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250400.308513##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250500.310045##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010250600.311543##/home/mos5200/yeliang/NOKIA 08:25 659
BSC941535.98.201010241500.288850##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241700.292190##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250100.303949##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250700.313032##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250800.314910##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010250900.316100##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241800.293259##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010241900.294751##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010242000.296252##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010242100.297775##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010242200.299337##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.98.201010250000.302477##/home/mos5200/yeliang/NOKIA 08:25 661
BSC941535.97.201010250400.308481##/home/mos5200/yeliang/NOKIA 08:25 339042
BSC941535.97.201010250500.310059##/home/mos5200/yeliang/NOKIA 08:25 342204
BSC941535.97.201010250600.311541##/home/mos5200/yeliang/NOKIA 08:25 347133
BSC941535.97.201010250300.306962##/home/mos5200/yeliang/NOKIA 08:25 353222
BSC941535.97.201010250200.305521##/home/mos5200/yeliang/NOKIA 08:25 356565
BSC941535.97.201010250700.313030##/home/mos5200/yeliang/NOKIA 08:25 361153
BSC941535.97.201010250800.314577##/home/mos5200/yeliang/NOKIA 08:25 375376
BSC941535.97.201010250900.316098##/home/mos5200/yeliang/NOKIA 08:25 378543
其中两个文件中均含有
BSC941535.98.201010241500.288850##/home/mos5200/yeliang/NOKIA 08:25 660
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
使用diff 命令后,这两个文件是作为不同的记录出现的,即:
2,3d1
BSC941535.98.201010241600.290179##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010241700.292190##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250100.303949##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250700.313032##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250800.314910##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010250900.316100##/home/mos5200/yeliang/NOKIA 08:25 660
> BSC941535.98.201010241800.293259##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010241900.294751##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010242000.296252##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010242100.297775##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010242200.299337##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.98.201010250000.302477##/home/mos5200/yeliang/NOKIA 08:25 661
> BSC941535.97.201010250400.308481##/home/mos5200/yeliang/NOKIA 08:25 339042
> BSC941535.97.201010250500.310059##/home/mos5200/yeliang/NOKIA 08:25 342204
> BSC941535.97.201010250600.311541##/home/mos5200/yeliang/NOKIA 08:25 347133
> BSC941535.97.201010250300.306962##/home/mos5200/yeliang/NOKIA 08:25 353222
> BSC941535.97.201010250200.305521##/home/mos5200/yeliang/NOKIA 08:25 356565
> BSC941535.97.201010250700.313030##/home/mos5200/yeliang/NOKIA 08:25 361153
> BSC941535.97.201010250800.314577##/home/mos5200/yeliang/NOKIA 08:25 375376
> BSC941535.97.201010250900.316098##/home/mos5200/yeliang/NOKIA 08:25 378543
明显不对 可是不知道为什么 哪位帮帮忙
|
这就是diff的行为 只不过你一开始误解了而已
|
diff 比较难用。一般跟patch组合使用。
反正我是很少用啊。
反正我是很少用啊。