From 7c34f085806c3e6687fc10e3ae5096e14f915a5f Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Fri, 10 Feb 2023 01:08:29 +0300 Subject: [PATCH] doc: bin: Document new AWK contrib script usage --- bin/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bin/README.md b/bin/README.md index c750fa71f..ed867063f 100644 --- a/bin/README.md +++ b/bin/README.md @@ -60,6 +60,20 @@ $ watchaccounts expenses -2 $ watchaccounts -f time.journal client1 date:thismonth -l ``` +### sortandmergepostings + +[`sortandmergepostings`](https://github.com/simonmichael/hledger/blob/master/bin/sortandmergepostings) +can be used to cleanup and normalize postings. +It will sort postings so that positive ones are first, negative ones last. +Inside of that it sorts postings by account name alphabetically. +Lastly it facilitates merging postings on transactions with more than one posting in the same direction on the same account. +This works by removing the duplicates and cleaning the amount field for at-most one account per run +Piping the output to `hledger print` can recalculate the missing amounts. +Subsequent runs can cleanup further duplicates. +```cli +$ sortandmergepostings input.journal | hledger -f - print -x +``` + ### hledger-simplebal [`hledger-simplebal`](https://github.com/simonmichael/hledger/blob/master/bin/hledger-simplebal)