0
我有一个补丁可以应用在遗留代码库上。有很多名为pom.xml
的文件在那里,其中的变化将被跳过。我如何从补丁中删除它们?删除某些不需要的文件diff
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,
到目前为止,我发现的所有解决方案或者删除模式中的起始行和尾行,或者不使用它们。
测试[潜在解决方案](http://www.unix.com/shell-programming-and-scripting/89484-delete-lines-between-two-patterns-without-deleting-second-pattern.html)' sed'/ FROM_HERE /,/ TO_HERE/{// p; d;}'' – Basilevs 2014-09-25 09:19:23