Remove gawk and uniq dependencies for listcon, listproj.
Implement listcon and listproj in terms of grep -w -o, which prints words that match the given regular expression, and sort -u, which obviates uniq. This probably only works with GNU grep, which seems better than having to rely on gawk (which is used nowhere else). Signed-off-by: Emil Sit <sit@emilsit.net> Signed-off-by: Gina Trapani <ginatrapani@gmail.com>
This commit is contained in:
4
todo.sh
4
todo.sh
@@ -687,11 +687,11 @@ case $action in
|
||||
;;
|
||||
|
||||
"listcon" | "lsc" )
|
||||
gawk '{for(i = 1; i <= NF; i++) print $i}' "$TODO_FILE" | grep '@' | sort | uniq
|
||||
grep -w -o '@[^ ]\+' "$TODO_FILE" | sort -u
|
||||
cleanup ;;
|
||||
|
||||
"listproj" | "lsprj" )
|
||||
gawk '{for(i = 1; i <= NF; i++) print $i}' "$TODO_FILE" | grep '+' | sort | uniq
|
||||
grep -w -o '+[^ ]\+' "$TODO_FILE" | sort -u
|
||||
cleanup ;;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user