2017-09-04 86 views
0

萊傑(http://ledger-cli.org/)允許使用下面的命令你的收入佔的輸出反向排序平衡:打印餘額CLI

ledger -f money.txt bal Income --sort "-abs(total)" 

所以輸出如下所示:

$-7,715.00 Income 
    $-6,789.10 Payroll 
    $-567.89 Insurance 
    $-234.56 Gift Card 
    $-200.56  Store 1 
    $-34.00  Store 2 
    $-123.45 Coupons 

有沒有辦法以CSV格式輸出相同的信息,但保留類別的縮進如下(標題值不重要)?

"Amount","Level 1","Level 2,"Level 3" 
    $-7,715.00,Income,, 
    ,$-6,789.10,Payroll, 
    ,$-567.89,Insurance, 
    ,$-234.56,Gift Card, 
    ,,$-200.56,Store 1 
    ,,$-34.00,Store 2 
    ,$-123.45,Coupons, 

回答

0

您可以使用--balance-format選項與任何documented format strings的。

例如要打印每行上的帳戶名稱和總金額: ledger -f money.txt balance ^Income --no-total --balance-format '%A,%T\n'