;bin:hledger-dc: make dr/cr case insensitive
This commit is contained in:
parent
f09ffe9b20
commit
cd3e4937bd
@ -6,7 +6,7 @@
|
||||
# If a posting begins with Dr<WHITESPACE>, remove that.
|
||||
# If it begins with Cr<WHITESPACE> and contains no number, remove that.
|
||||
# If it begins with Cr<WHITESPACE>, 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}"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user