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 <jon@smajda.com>; fix developed
in conjunction with Philippe Teuwen <phil@teuwen.org>.

Signed-off-by: Emil Sit <sit@emilsit.net>
This commit is contained in:
Emil Sit
2009-05-10 21:50:30 -04:00
parent 78850255e0
commit 64573dbd0c

View File

@@ -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 ;;