如何将hledger日记账中的过账对齐到指定列
统一对齐hledger日记账中的金额列
这是《Right justify amounts in hledger journal text file》的跟进需求:hledger是一款纯文本会计CLI工具,它仅能对齐单笔交易内的过账条目,但无法将整个日记账里的所有过账金额统一对齐到指定列。
现在需要实现的效果是:调整缩进账户名称与右侧金额之间的空格,让所有金额对齐到同一列。这类需求用awk、printf这类命令行工具即可完成,输入输出示例如下:
输入示例
# Test journal ; To test right-alignment of amounts * Transactions 2018-01-01 @Payee | Internet expenses:communication:internet 123.00 EUR assets:cash:eur 2018-01-01 @Landlady | Rent expenses:housing:rent 321.00 EUR expenses:fees 2.50 EUR ; Bank fee assets:bank:eur -323.50 EUR 2016/01/01 Unit prices Expense:Foo 56 @ $6.00 ; a comment after a space Cash $-336 ; a comment after two spaces 2022-01-01 Time skill 10000h time -10000h weird ; weird comment on posting without amount 2018-01-01 @Some things in life | Are free ; With and without comment expenses:misc:stuff 0 ; A comment expenses:misc:things 0 assets:cash:eur
输出示例
# Test journal ; To test right-alignment of amounts * Transactions 2018-01-01 @Payee | Internet expenses:communication:internet 123.00 EUR assets:cash:eur 2018-01-01 @Landlady | Rent expenses:housing:rent 321.00 EUR expenses:fees 2.50 EUR ; Bank fee assets:bank:eur -323.50 EUR 2016/01/01 Unit prices Expense:Foo 56 @ $6.00 ; a comment after a space Cash $-336 ; a comment after two spaces 2022-01-01 Time skill 10000h time -10000h weird ; weird comment on posting without amount 2018-01-01 @Some things in life | Are free ; With and without comment expenses:misc:stuff 0 ; A comment expenses:misc:things 0 assets:cash:eur
内容的提问来源于stack exchange,提问作者Leeroy
相关产品推荐
相关产品推荐

