Compare commits

...

1 Commits

Author SHA1 Message Date
Ingo Karkat
f3fc18af6b Optimization: Put grep -v empty task filter inside sed.
No need to spawn off another process for this; we can do this inside the sed command that joins the task numbers with the task text.

Note: The sed on OS X does not understand the \+ bound, only in the form of + when used with -E. Instead, I chose to fall back to the \{1,\} basic regexp, in the hope that it is very portable, and to avoid introducing extended regexps to the script.
2012-01-23 11:55:15 +01:00

View File

@@ -785,12 +785,12 @@ _list() {
fi
items=$(
sed = "$src" \
| sed '''
| sed -e '''
N
s/^/ /
s/ *\([ 0-9]\{'"$PADDING"',\}\)\n/\1 /
''' \
| grep -v "^[ 0-9]\+ *$"
/^[ 0-9]\{1,\} *$/d
'''
)
if [ "${filter_command}" ]; then
filtered_items=$(echo -n "$items" | eval "${filter_command}")