a few minor updates for z-every-line
This commit is contained in:
parent
36a5af831c
commit
ab103b0c12
@ -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 $!;
|
||||
#}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user