aboutsummaryrefslogtreecommitdiff
path: root/src/misc
diff options
context:
space:
mode:
authorjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-13 12:59:49 +0000
committerjthorn <jthorn@f88db872-0e4f-0410-b76b-b9085cfa78c5>2002-04-13 12:59:49 +0000
commit1490faef8948e569c3f331309a67082a70238469 (patch)
tree745ee0ae44fb567029e18919b1301372b7ba2a43 /src/misc
parentb99d0f7d3d2bce81d366425c05655a4841a5bc7c (diff)
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
Diffstat (limited to 'src/misc')
-rwxr-xr-xsrc/misc/select.patch36
1 files changed, 36 insertions, 0 deletions
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.adat >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 >data-for-that-patch\n"; }
+my $patch_name = $ARGV[0];
+
+my $in_selected_patch = 0;
+my $newline_count = 0;
+ while (my $line = <STDIN>)
+ {
+ 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; }
+ }
+ }