我需要一个命令/脚本来获取 CVS 合并冲突。基本上,我需要一个 SED 或 AWK 命令来仅打印两个设置模式之间的行
例子:
Pattern1="RCS file:"
Pattern2="conflicts during merge"
当我尝试一个简单的 SED 命令时,例如:
sed -n '/RCS file:/,/conflicts during merge /p' INPUT.txt
我没有得到预期的输出。我只想捕获“filename2 和 filename3”的详细信息(在合并期间有冲突)。
有人可以帮忙吗?
INPUT.txt
RCS file: /hello/filename1
retrieving revision 1.4.2.1.18.2.2.1
retrieving revision 1.4.2.1.18.2.2.1.4.2
Merging differences between 1.4.2.1.18.2.2.1 and 1.4.2.1.18.2.2.1.4.2 into filename1
RCS file: /hello/filename2
retrieving revision 1.4.2.1.18.2.2.1
retrieving revision 1.4.2.1.18.2.2.1.4.2
Merging differences between 1.4.2.1.18.2.2.1 and 1.4.2.1.18.2.2.1.4.2 into filename2
rcsmerge: warning: conflicts during merge
RCS file: /hello/filename3
retrieving revision 1.6.18.1.2.1.2.1
retrieving revision 1.6.18.1.2.1.2.1.4.3
Merging differences between 1.6.18.1.2.1.2.1 and 1.6.18.1.2.1.2.1.4.3 into filename3
rcsmerge: warning: conflicts during merge
RCS file: /hello/filename4
retrieving revision 1.4.2.1.18.2.2.1
retrieving revision 1.4.2.1.18.2.2.1.4.2
Merging differences between 1.4.2.1.18.2.2.1 and 1.4.2.1.18.2.2.1.4.2 into filename4
(Expected) OUTPUT.txt
RCS file: /hello/filename2
retrieving revision 1.4.2.1.18.2.2.1
retrieving revision 1.4.2.1.18.2.2.1.4.2
Merging differences between 1.4.2.1.18.2.2.1 and 1.4.2.1.18.2.2.1.4.2 into filename2
rcsmerge: warning: conflicts during merge
RCS file: /hello/filename3
retrieving revision 1.6.18.1.2.1.2.1
retrieving revision 1.6.18.1.2.1.2.1.4.3
Merging differences between 1.6.18.1.2.1.2.1 and 1.6.18.1.2.1.2.1.4.3 into filename3
rcsmerge: warning: conflicts during merge