camonitor_sort.pl: Support inverse regexp matches.
bin/camonitor_sort.pl
Warning, cannot access the index:
_darcs/index: opening of '_darcs/index' failed: permission denied (Permission denied)
diff -rN -u old-bii_scripts/bin/camonitor_sort.pl new-bii_scripts/bin/camonitor_sort.pl
--- old-bii_scripts/bin/camonitor_sort.pl 2022-11-28 22:04:14.700562753 +0100
+++ new-bii_scripts/bin/camonitor_sort.pl 2022-11-28 22:04:14.700562753 +0100
@@ -94,14 +94,28 @@
sub mk_regexp
{ my($funcname,$regexp)= @_;
+ my $invert= 0;
return if (!defined $regexp);
+ if ($regexp =~ /^!(.*)/)
+ {
+ $regexp= $1;
+ $invert= 1;
+ }
+
if ($regexp !~ /^\//)
{ $regexp= '/' . $regexp . '/'; };
#die "eval:\"sub n_regexp { return(\$_[0]=~ $regexp); }\"";
- eval("sub $funcname { return(\$_[0]=~ $regexp); }");
+ if (!$invert)
+ {
+ eval("sub $funcname { return(\$_[0]=~ $regexp); }");
+ }
+ else
+ {
+ eval("sub $funcname { return(\$_[0]!~ $regexp); }");
+ }
if ($@)
{ die "error: eval() failed, error-message:\n" . $@ . " " };
}
@@ -214,6 +228,9 @@
Syntax:
$sc_name {options}
+ Note: every regexp that starts with '!' is a "do not match" regexp. In this
+ case theresults are the ones that DO NOT match.
+
options:
-h: help
--summary: give a summary of the script
patch 5efecc1f633add866526b66ffba00e12e0d723fa
Author: Goetz.Pfeiffer@helmholtz-berlin.de
Date: Fri Mar 25 22:20:17 CET 2022
* camonitor_sort.pl: Support inverse regexp matches