--- todo.sh.orig	2006-10-05 15:44:16.697253984 -0400
+++ todo.sh	2006-10-05 15:46:41.765200304 -0400
@@ -63,6 +63,12 @@
           sorted by priority with line  numbers.  If no TERM specified, lists
           entire todo.txt AND done.txt concatenated and sorted.
 
+        listdone [TERM...]
+        lsd [TERM...]
+          Displays all the lines in done.txt that contain TERM(s) sorted by 
+          priority with line  numbers.  If no TERM specified, lists entire 
+          done.txt concatenated and sorted.
+
         listpri [PRIORITY]
         lsp [PRIORITY]
           Displays all items prioritized PRIORITY.
@@ -319,6 +325,29 @@
 	fi
 	cleanup ;;
 
+
+"listdone" | "lsd" )
+	item=$2
+	if [ -z "$item" ]; then
+		echo -e "`sed = "$DONE_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1 /' | sed 's/^ /0/' | sort -f -k2 | sed '/^[0-9][0-9] x /!s/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed '/^[0-9][0-9] x /!s/\(.*(B).*\)/'$PRI_B'\1'$DEFAULT'/g' | sed '/^[0-9][0-9] x /!s/\(.*(C).*\)/'$PRI_C'\1'$DEFAULT'/g' | sed '/^[0-9][0-9] x /!s/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/'`"
+		echo "--"
+		NUMTASKS=$(wc -l "$DONE_FILE" | sed 's/^[[:space:]]*\([0-9]*\).*/\1/')
+		echo "DONE: $NUMTASKS tasks in $DONE_FILE."
+	else
+		command=`sed = "$DONE_FILE" | sed 'N; s/^/  /; s/ *\(.\{2,\}\)\n/\1 /' | sed 's/^ /0/' | sort -f -k2 | sed '/^[0-9][0-9] x /!s/\(.*(A).*\)/'$PRI_A'\1'$DEFAULT'/g' | sed '/^[0-9][0-9] x /!s/\(.*(B).*\)/'$PRI_B'\1'$DEFAULT'/g' | sed '/^[0-9][0-9] x /!s/\(.*(C).*\)/'$PRI_C'\1'$DEFAULT'/g' | sed '/^[0-9][0-9] x /!s/\(.*([A-Z]).*\)/'$PRI_X'\1'$DEFAULT'/' | grep -i $item `
+		shift
+		shift
+		for i in $*
+			do
+			command=`echo "$command" | grep -i $i `
+			done
+		command=`echo "$command" | sort -f -k2`
+
+		echo -e "$command"
+	fi
+	cleanup ;;
+
+
 "listpri" | "lsp" )
 	pri=$( printf "%s\n" "$2" | tr 'a-z' 'A-Z' )
 

