From 1490faef8948e569c3f331309a67082a70238469 Mon Sep 17 00:00:00 2001 From: jthorn Date: Sat, 13 Apr 2002 12:59:49 +0000 Subject: move select.patch from util/ to new directory misc/ git-svn-id: http://svn.einsteintoolkit.org/cactus/EinsteinAnalysis/AHFinderDirect/trunk@501 f88db872-0e4f-0410-b76b-b9085cfa78c5 --- src/misc/select.patch | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 src/misc/select.patch (limited to 'src/misc') diff --git a/src/misc/select.patch b/src/misc/select.patch new file mode 100755 index 0000000..b06e129 --- /dev/null +++ b/src/misc/select.patch @@ -0,0 +1,36 @@ +#!/usr/local/bin/perl -w +# $Id$ + +# +# Usage: +# mpe.patch patch.name file.patch.adat +# +# This filter prints that part of standard input starting with a +# line of the form (eg) +# ## +z patch +# and continuing up to and including two consecutive newlines. +# + +use strict; + +if (scalar(@ARGV) != 1) + { die "usage: select.patch patch.name data-for-that-patch\n"; } +my $patch_name = $ARGV[0]; + +my $in_selected_patch = 0; +my $newline_count = 0; + while (my $line = ) + { + if ($line =~ /^### \Q${patch_name}/o) + { $in_selected_patch = 1; } + if ($line =~ /^\n/) + { ++$newline_count; } + else { $newline_count = 0; } + + if ($in_selected_patch) + { + print $line; + if ($newline_count == 2) + { last; } + } + } -- cgit v1.2.3