;doc:scripts:sortandmergepostings: give a little more context
This commit is contained in:
parent
59999e4ada
commit
6b2cb5124a
@ -198,13 +198,14 @@ $ watchaccounts -f time.journal client1 date:thismonth -l
|
|||||||
### sortandmergepostings
|
### sortandmergepostings
|
||||||
|
|
||||||
[`sortandmergepostings`](https://github.com/simonmichael/hledger/blob/master/bin/sortandmergepostings)
|
[`sortandmergepostings`](https://github.com/simonmichael/hledger/blob/master/bin/sortandmergepostings)
|
||||||
can be used to cleanup and normalize postings.
|
is an adventuresome awk script intended to clean up and merge similar postings in a transaction
|
||||||
It will sort postings so that positive ones are first, negative ones last.
|
(see [original discussion](https://unix.stackexchange.com/questions/526995/re-order-lines-and-merge-others-based-on-a-specific-criteria/527004)).
|
||||||
Inside of that it sorts postings by account name alphabetically.
|
It sorts postings so that positive ones are first, negative ones last.
|
||||||
|
Within each sign, postings are sorted alphabetically by account name.
|
||||||
Lastly it facilitates merging postings on transactions with more than one posting in the same direction on the same account.
|
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
|
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.
|
Piping the output to `hledger print` can recalculate the missing amounts.
|
||||||
Subsequent runs can cleanup further duplicates.
|
Multiple runs might be needed to clean up all duplicates.
|
||||||
```cli
|
```cli
|
||||||
$ sortandmergepostings input.journal | hledger -f - print -x
|
$ sortandmergepostings input.journal | hledger -f - print -x
|
||||||
```
|
```
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user