This document describes a simple plain text ledger based on ledger-cli and cookie-jar format.
The goal of this document is to describe a bookkeeping format that is simple enough to be parsed with regular Unix tools such as Awk.
Cookie-jar format:
0000/00/00 Description
Assets:Account 0.00
Liabilities:Account -0.00
\n
Header structure:
the first field | all fields to the right |
---|---|
0000/00/00 | A single line escription including spaces |
- The very first field, e.g, Awk's
$1
, must be interpreted a date. - All the remaining fields, e.g. Awk's
$2
though$FN
, must be interpreted as a single line description.
Body structure:
all fields to the left | the last field |
---|---|
Assets:Account with spaces | 0.00 |
Liabilities:AccountNoSpaces | -0.00 |
- The last field, e.g, Awk's
$NF
, must be interpreted as decimal value. - All the previous fields, e.g. Awk's
$1
though$NF-1
, must be interpreted as a single account name.
Rules:
- A transaction is a record.
- A record contains a header and a body.
- The first line is the header, and the following lines are the body.
- The header contains its date and an optional description.
- The body contains a set of entries, each in it's corresponding line.
- Each entry has the name of an account along with a mandatory value.
- The records are separated by blank lines (cookie-jar format with records separated by blank lines).
- When printing, the transaction description and the entry values may be aligned to the right.
Print example:
2004/09/29 Circuit City
Assets:Reimbursements:Company XYZ 100.00
Liabilities:MasterCard -100.00
2004/10/15 Company XYZ
Assets:Checking 100.00
Assets:Reimbursements:Company XYZ -100.00
2004/09/29 Circuit City
Assets:Reimbursements:Company XYZ 100.00
Liabilities:MasterCard -100.00
2004/10/15 Company XYZ
Assets:Checking 100.00
Assets:Reimbursements:Company XYZ -100.00
2004/09/29 Circuit City
Assets:Reimbursements:Company XYZ 100.00
Liabilities:MasterCard -100.00
2004/10/15 Company XYZ
Assets:Checking 100.00
Assets:Reimbursements:Company XYZ -100.00
2004/09/29 Circuit City
Assets:Reimbursements:Company XYZ 100.00
Liabilities:MasterCard -100.00
2004/10/15 Company XYZ
Assets:Checking 100.00
Assets:Reimbursements:Company XYZ -100.00
2004/09/29 Circuit City
Assets:Reimbursements:Company XYZ 100.00
Liabilities:MasterCard -100.00
2004/10/15 Company XYZ
Assets:Checking 100.00
Assets:Reimbursements:Company XYZ -100.00
2004/09/29 Circuit City
Assets:Reimbursements:Company XYZ 100.00
Liabilities:MasterCard -100.00
2004/10/15 Company XYZ
Assets:Checking 100.00
Assets:Reimbursements:Company XYZ -100.00