Awk 从未填充的差异中删除某些文件

Awk 从未填充的差异中删除某些文件,awk,sed,patch,unified-diff,Awk,Sed,Patch,Unified Diff,我有一个补丁应用于遗留代码库。有许多文件名为pom.xmlis,需要跳过对这些文件的更改。如何从修补程序中删除它们 sed '/^diff --git .*pom.xml$/,/^diff --git/d' 在末尾删除一个额外的行(需要进一步处理) 我可能需要一个解决方案来删除两个模式之间的行,包括第一个模式和排除第二个模式。我仅限于MSYS,因此只能访问Windows命令、sed和mawk 下面是一个输入示例。这里有三个条目,第二个条目将被删除 diff --git a/core/conte

我有一个补丁应用于遗留代码库。有许多文件名为
pom.xml
is,需要跳过对这些文件的更改。如何从修补程序中删除它们

sed '/^diff --git .*pom.xml$/,/^diff --git/d'
在末尾删除一个额外的行(需要进一步处理)

我可能需要一个解决方案来删除两个模式之间的行,包括第一个模式和排除第二个模式。我仅限于MSYS,因此只能访问Windows命令、sed和mawk

下面是一个输入示例。这里有三个条目,第二个条目将被删除

diff --git a/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF b/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF
index a02c3f0..b74197f 100644
--- a/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF
+++ b/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Q7 Debug
 Bundle-SymbolicName: org.eclipse.rcptt.ctx.debug;singleton:=true
-Bundle-Version: 1.5.0.qualifier
+Bundle-Version: 1.5.3.qualifier
 Bundle-ClassPath: .
 Bundle-Vendor: Eclipse RCP Testing Tool Project
 Bundle-Localization: plugin
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.rcptt.core;bundle-version="[1.5.0,1.6.0)";visibility:=reexport
+ org.eclipse.rcptt.core;bundle-version="[1.5.3,1.6.0)";visibility:=reexport
 Bundle-ActivationPolicy: lazy
 Export-Package: org.eclipse.rcptt.debug,
  org.eclipse.rcptt.debug.impl,
diff --git a/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml b/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml
index e12f814..e18b46a 100644
--- a/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml
+++ b/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml
@@ -4,10 +4,10 @@
   <parent>
     <artifactId>rcptt.core.contexts</artifactId>
     <groupId>org.eclipse.rcptt</groupId>
-    <version>1.5.0-SNAPSHOT</version>
+    <version>1.5.3-SNAPSHOT</version>
   </parent>
   <groupId>org.eclipse.rcptt</groupId>
   <artifactId>org.eclipse.rcptt.ctx.debug</artifactId>
-  <version>1.5.0-SNAPSHOT</version>
+  <version>1.5.3-SNAPSHOT</version>
   <packaging>eclipse-plugin</packaging>
 </project>
diff --git a/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF b/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF
index 88ccb8b..b8c1308 100644
--- a/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF
+++ b/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Q7 Context Extensions
 Bundle-SymbolicName: org.eclipse.rcptt.ctx.extensions;singleton:=true
-Bundle-Version: 1.5.0.qualifier
+Bundle-Version: 1.5.3.qualifier
 Bundle-Activator: org.eclipse.rcptt.ctx.extensions.ContextExtensionsPlugin
 Bundle-Vendor: Eclipse RCP Testing Tool Project
 Require-Bundle: org.eclipse.core.runtime,
diff--git a/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF b/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF
索引a02c3f0..b74197f 100644
---a/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF
+++b/core/contexts/org.eclipse.rcptt.ctx.debug/META-INF/MANIFEST.MF
@@-2,13+2,13@@Manifest版本:1.0
软件包版本:2
捆绑包名称:Q7调试
Bundle SymbolicName:org.eclipse.rcptt.ctx.debug;单例:=true
-捆绑包版本:1.5.0.0
+捆绑包版本:1.5.3.1
包类路径:。
捆绑包供应商:EclipseRCP测试工具项目
捆绑本地化:插件
Bundle-RequiredExecutionEnvironment:JavaSE-1.6
需要捆绑包:org.eclipse.core.runtime,
-org.eclipse.rcptt.core;捆绑包版本=“[1.5.0,1.6.0]”;可见性:=重新导出
+org.eclipse.rcptt.core;bundle version=“[1.5.3,1.6.0]”;可见性:=重新导出
捆绑包激活策略:惰性
导出包:org.eclipse.rcptt.debug,
org.eclipse.rcptt.debug.impl,
diff——git a/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml b/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml
索引e12f814..e18b46a 100644
---a/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml
+++b/core/contexts/org.eclipse.rcptt.ctx.debug/pom.xml
@@ -4,10 +4,10 @@
rcptt.core.contexts
org.eclipse.rcptt
-1.5.0-快照
+1.5.3-快照
org.eclipse.rcptt
org.eclipse.rcptt.ctx.debug
-1.5.0-快照
+1.5.3-快照
eclipse插件
diff——git a/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF b/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF
索引88ccb8b..b8c1308 100644
---a/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF
+++b/core/contexts/org.eclipse.rcptt.ctx.extensions/META-INF/MANIFEST.MF
@@-2,7+2,7@@Manifest版本:1.0
软件包版本:2
捆绑包名称:Q7上下文扩展
Bundle SymbolicName:org.eclipse.rcptt.ctx.extensions;singleton:=true
-捆绑包版本:1.5.0.0
+捆绑包版本:1.5.3.1
Bundle Activator:org.eclipse.rcptt.ctx.extensions.contextensionsplugin
捆绑包供应商:EclipseRCP测试工具项目
需要捆绑包:org.eclipse.core.runtime,

到目前为止,我找到的所有解决方案要么删除带有图案的起始线和尾随线,要么一个也不删除。

最后,一个有效的解决方案:

awk '
  /^diff --git/ {skip = 0}
  /^diff --git .*pom.xml$/ { skip = 1}
  {if (!skip) print $0}
' 
这可能不是sed的工作。

测试
sed'/FROM_HERE/,/TO_HERE/{//p;d;}'