From ab103b0c12551b0fc1ee43f76da07dd9d709235f Mon Sep 17 00:00:00 2001 From: Michael Moon Date: Wed, 26 Sep 2012 18:49:42 +1000 Subject: [PATCH] a few minor updates for z-every-line --- utils/post-processing/z-every-line.pl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utils/post-processing/z-every-line.pl b/utils/post-processing/z-every-line.pl index 49d5f4502..aaf57e172 100755 --- a/utils/post-processing/z-every-line.pl +++ b/utils/post-processing/z-every-line.pl @@ -8,17 +8,17 @@ my $z = 0; # read stdin and any/all files passed as parameters one line at a time while (<>) { # if we find a Z word, save it - $z = $1 if /Z(\d+(\.\d+)?)/; + $z = $1 if /Z\s*(\d+(\.\d+)?)/; # if we don't have Z, but we do have X and Y if (!/Z/ && /X/ && /Y/ && $z > 0) { # chop off the end of the line (incl. comments), saving chopped section in $1 - s/\s*([\r\n\;\(].*)//s; + s/\s*([\r\n\;\(].*)/" Z$z $1"/es; # print start of line, insert our Z value then re-add the chopped end of line - print "$_ Z$z $1"; + # print "$_ Z$z $1"; } - else { + #else { # nothing interesting, print line as-is - print; - } + print or die $!; + #} }