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