From 5252576b7e23873baa7ec8f5164cae87bbda1b43 Mon Sep 17 00:00:00 2001 From: Gonzalo TornarĂ­a Date: Sun, 20 Feb 2022 13:22:31 -0300 Subject: xlint: fix bug in previous commit In scan() I was using $argument in the sed script, but oftentimes $arguments is a path including slashes which breaks havoc. Different way now, hopefully this is correct now. Note that $msg has to go through sed since some messages use `\2` to show the matching line. --- xlint | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/xlint b/xlint index 191d51e..422e367 100755 --- a/xlint +++ b/xlint @@ -7,9 +7,12 @@ export LC_ALL=C scan() { local rx="$1" msg="$2" - grep -P -Hn -e "$rx" "$template" | - grep -v -P -e "[^:]*:[^:]*:\s*#" | - sed "s/^[^:]*:\([^:]*\):\(.*\)/$argument:\1: $msg/" + grep -P -hn -e "$rx" "$template" | + grep -v -P -e "[^:]*:\s*#" | + sed "s/^\([^:]*\):\(.*\)/\1: $msg/" | + while read line; do + echo "$argument:$line" + done } once() { -- cgit 1.4.1