2017-02-11 05:18:17 +03:00
|
|
|
# hledger CSV conversion rules for tarsnap.com's "Recent activity (all machines)"
|
2017-02-11 04:45:20 +03:00
|
|
|
#
|
|
|
|
# RECTYPE,DATE,MACHINE,TYPE,QUANTITY,AMOUNT,BALANCE
|
|
|
|
# Balance,2016-12-28,,,,,28.396910846961952530
|
|
|
|
# Usage,2016-12-28,machine1,Client->Server bandwidth,729977109,0.182494277250000000,
|
|
|
|
# Usage,2016-12-28,machine1,Daily storage,94917624870,0.765464704446112920,
|
|
|
|
# Usage,2016-12-28,machine1,Server->Client bandwidth,132739070,0.033184767500000000,
|
|
|
|
|
|
|
|
skip 1
|
|
|
|
fields rectype,date,machine,type,quantity,amount,balance
|
|
|
|
|
|
|
|
account1 assets:tarsnap
|
|
|
|
|
|
|
|
if ^Balance,
|
|
|
|
description %rectype: $%balance
|
2017-02-11 05:18:17 +03:00
|
|
|
account1 dummy
|
2017-02-11 04:45:20 +03:00
|
|
|
account2 dummy
|
|
|
|
amount $0
|
2017-02-11 05:18:17 +03:00
|
|
|
# TODO zero amount is always rendered without commodity symbol
|
2017-02-11 04:45:20 +03:00
|
|
|
|
|
|
|
if ^Usage,
|
|
|
|
description %machine %type
|
|
|
|
account2 expenses:tarsnap:%machine:%type
|
|
|
|
amount -%quantity bytes @@ $%amount
|
2017-02-11 04:54:58 +03:00
|
|
|
|
|
|
|
# sample output:
|
2017-02-11 05:18:17 +03:00
|
|
|
# $ hledger -f tarsnap.csv bal -B cur:\\$ -MAT expenses
|
|
|
|
# using conversion rules file tarsnap.csv.rules
|
2017-02-11 04:54:58 +03:00
|
|
|
# Balance changes in 2016/12/01-2017/02/28:
|
|
|
|
#
|
|
|
|
# || 2016/12 2017/01 2017/02 Total Average
|
|
|
|
# ====================================================++===================================================================================================================
|
|
|
|
# expenses:tarsnap:machine1:Client->Server bandwidth || $0.724738970500000000 $4.479661574000000000 $1.922747437750000000 $7.127147982250000000 $2.375715994083333333
|
|
|
|
# expenses:tarsnap:machine1:Daily storage || $3.031766211919159188 $23.945385100696412904 $8.584370624209118831 $35.561521936824690923 $11.853840645608230308
|
|
|
|
# expenses:tarsnap:machine1:Server->Client bandwidth || $0.196816259250000000 $0.798626419000000000 $0.273752084250000000 $1.269194762500000000 $0.423064920833333333
|
|
|
|
# ----------------------------------------------------++-------------------------------------------------------------------------------------------------------------------
|
|
|
|
# || $3.953321441669159188 $29.223673093696412904 $10.780870146209118831 $43.957864681574690923 $14.652621560524896974
|