From cd3e4937bd17ddc291e4a2b0f71c20828dc27ccd Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 27 Sep 2025 09:27:28 -1000 Subject: [PATCH] ;bin:hledger-dc: make dr/cr case insensitive --- bin/hledger-dc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/hledger-dc b/bin/hledger-dc index 7ee5c9a3f..949b0f0b1 100755 --- a/bin/hledger-dc +++ b/bin/hledger-dc @@ -6,7 +6,7 @@ # If a posting begins with Dr, remove that. # If it begins with Cr and contains no number, remove that. # If it begins with Cr, remove that and add a minus sign before the next number, and if that leaves a double minus, cancel those out. -dc2sign() { sed -E -e 's/^(\s+)Dr\s+/\1/' -e 's/^(\s+)Cr\s+([^0-9]+)$/\1\2/' -e 's/^(\s+)Cr\s+([^0-9]+)([0-9])/\1\2-\3/' -e 's/--([0-9])/\1/'; } +dc2sign() { sed -E -e 's/^(\s+)Dr\s+/\1/i' -e 's/^(\s+)Cr\s+([^0-9]+)$/\1\2/i' -e 's/^(\s+)Cr\s+([^0-9]+)([0-9])/\1\2-\3/i' -e 's/--([0-9])/\1/'; } dc2sign <"$1" | hledger -f- "${@:2}"