From a4227dfec1128be1f42f72afed5e0b41fe361ab6 Mon Sep 17 00:00:00 2001 From: Emil Sit Date: Sun, 10 May 2009 21:50:30 -0400 Subject: [PATCH] listcon/listproj: Work around bug in older GNU greps. Commit df4f9150 introduced the use of "grep -w -o". This combination was broken from the introduction of -o (in 2001) until subsequent release of GNU grep 2.5.3 in 2007---see changelog for 2005-11-10. In particular, OS X uses a pre-2.5.3 version of GNU grep. Work around by replacing with two greps: one to find maximal strings with @s in them (still relying on -o) and the second to extract contexts. Reported by Jon Smajda ; fix developed in conjunction with Philippe Teuwen . Signed-off-by: Emil Sit --- todo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/todo.sh b/todo.sh index e291d72..8dfa206 100755 --- a/todo.sh +++ b/todo.sh @@ -726,11 +726,11 @@ case $action in ;; "listcon" | "lsc" ) - grep -w -o '@[^ ]\+' "$TODO_FILE" | sort -u + grep -o '[^ ]*@[^ ]\+' "$TODO_FILE" | grep '^@' | sort -u cleanup ;; "listproj" | "lsprj" ) - grep -w -o '+[^ ]\+' "$TODO_FILE" | sort -u + grep -o '[^ ]*+[^ ]\+' "$TODO_FILE" | grep '^+' | sort -u cleanup ;;