linux文件merge,merge(执行三向文件合并)_语法_示例_Unix&Linux命令_uc电脑园官网...

Let's say we have a file named orig.txt with the following contents.

Apples are red.

Oranges are orange.

Blueberries are delicious.

...and a file named mod1.txt, which is a modified version of orig.txt:

Apples are obviously red.

Oranges are blue.

Blueberries are delicious.

...and a file named mod2.txt, which is also a modified version of orig.txt:

Apples are obviously red.

Oranges are NOT blue.

Blueberries are delicious.

...and we run merge as follows:

merge mod1.txt orig.txt mod2.txt

It will analyze all three files, write to mod1.txt, and display the following warning:

merge: warning: conflicts during merge

This means that the merge was successful, but we should be aware that there was a conflict. If we open mod1.txt — which by default is the file where the merge is written — we will find that it now contains the following text:

<<<<<<< mod1.txt

Apples are obviously red.

Oranges are blue.

=======

Apples are obviously red.

Oranges are NOT blue.

>>>>>>> mod2.txt

Blueberries are delicious.

It is up to us to decide which "Oranges are..." line to keep (or to combine them in our own way), and make the edit to the file manually.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值