doc: explain print's CSV output

[ci skip]
This commit is contained in:
Simon Michael 2017-01-10 12:23:46 -08:00
parent 082b156e87
commit af71a020ff
4 changed files with 159 additions and 36 deletions

View File

@ -373,6 +373,31 @@ The print command also supports
and
[CSV output](#csv-output).
Here's an example of print's CSV output:
```shell
"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
```
- There is one CSV record per posting, with the parent transaction's fields repeated.
- The "txnidx" (transaction index) field shows which postings belong to the same transaction.
(This number might change if transactions are reordered within the file,
files are parsed/included in a different order, etc.)
- The amount is separated into "commodity" (the symbol) and "amount" (numeric quantity) fields.
- The numeric amount is repeated in either the "credit" or "debit" column, for convenience.
(Those names are not accurate in the accounting sense; it just puts negative amounts under
credit and zero or greater amounts under debit.)
## register
Show postings and their running total. Alias: reg.

View File

@ -1841,6 +1841,41 @@ hledger\[aq]s print command also shows all unit prices in effect, or
(with \-B/\-\-cost) shows cost amounts.
.PP
The print command also supports output destination and CSV output.
.PP
Here\[aq]s an example of print\[aq]s CSV output:
.IP
.nf
\f[C]
"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting\-status","posting\-comment"
"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
"1","2008/01/01","","","","income","","income:salary","\-1","$","1","","",""
"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
"2","2008/06/01","","","","gift","","income:gifts","\-1","$","1","","",""
"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
"3","2008/06/02","","","","save","","assets:bank:checking","\-1","$","1","","",""
"4","2008/06/03","","*","","eat\ &\ shop","","expenses:food","1","$","","1","",""
"4","2008/06/03","","*","","eat\ &\ shop","","expenses:supplies","1","$","","1","",""
"4","2008/06/03","","*","","eat\ &\ shop","","assets:cash","\-2","$","2","","",""
"5","2008/12/31","","*","","pay\ off","","liabilities:debts","1","$","","1","",""
"5","2008/12/31","","*","","pay\ off","","assets:bank:checking","\-1","$","1","","",""
\f[]
.fi
.IP \[bu] 2
There is one CSV record per posting, with the parent transaction\[aq]s
fields repeated.
.IP \[bu] 2
The "txnidx" (transaction index) field shows which postings belong to
the same transaction.
(This number might change if transactions are reordered within the file,
files are parsed/included in a different order, etc.)
.IP \[bu] 2
The amount is separated into "commodity" (the symbol) and "amount"
(numeric quantity) fields.
.IP \[bu] 2
The numeric amount is repeated in either the "credit" or "debit" column,
for convenience.
(Those names are not accurate in the accounting sense; it just puts
negative amounts under credit and zero or greater amounts under debit.)
.SS register
.PP
Show postings and their running total.

View File

@ -1514,6 +1514,38 @@ original content exactly (eg directives).
The print command also supports output destination and CSV output.
Here's an example of print's CSV output:
"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
* There is one CSV record per posting, with the parent transaction's
fields repeated.
* The "txnidx" (transaction index) field shows which postings belong
to the same transaction. (This number might change if transactions
are reordered within the file, files are parsed/included in a
different order, etc.)
* The amount is separated into "commodity" (the symbol) and "amount"
(numeric quantity) fields.
* The numeric amount is repeated in either the "credit" or "debit"
column, for convenience. (Those names are not accurate in the
accounting sense; it just puts negative amounts under credit and
zero or greater amounts under debit.)

File: hledger.1.info, Node: register, Next: stats, Prev: print, Up: COMMANDS
@ -2289,41 +2321,41 @@ Node: man45534
Ref: #man45631
Node: print46034
Ref: #print46139
Node: register47485
Ref: #register47598
Node: Custom register output52090
Ref: #custom-register-output52221
Node: stats53518
Ref: #stats53624
Node: test54504
Ref: #test54591
Node: ADD-ON COMMANDS54958
Ref: #add-on-commands55094
Node: api56382
Ref: #api56474
Node: autosync56508
Ref: #autosync56623
Node: diff58938
Ref: #diff59048
Node: equity59712
Ref: #equity59826
Node: interest61154
Ref: #interest61271
Node: irr64355
Ref: #irr64468
Node: print-unique66843
Ref: #print-unique66973
Node: rewrite67231
Ref: #rewrite67350
Node: ui67879
Ref: #ui67979
Node: web68020
Ref: #web68108
Node: TROUBLESHOOTING68141
Ref: #troubleshooting68260
Node: Run-time problems68314
Ref: #run-time-problems68457
Node: Known limitations70401
Ref: #known-limitations70544
Node: register49249
Ref: #register49362
Node: Custom register output53854
Ref: #custom-register-output53985
Node: stats55282
Ref: #stats55388
Node: test56268
Ref: #test56355
Node: ADD-ON COMMANDS56722
Ref: #add-on-commands56858
Node: api58146
Ref: #api58238
Node: autosync58272
Ref: #autosync58387
Node: diff60702
Ref: #diff60812
Node: equity61476
Ref: #equity61590
Node: interest62918
Ref: #interest63035
Node: irr66119
Ref: #irr66232
Node: print-unique68607
Ref: #print-unique68737
Node: rewrite68995
Ref: #rewrite69114
Node: ui69643
Ref: #ui69743
Node: web69784
Ref: #web69872
Node: TROUBLESHOOTING69905
Ref: #troubleshooting70024
Node: Run-time problems70078
Ref: #run-time-problems70221
Node: Known limitations72165
Ref: #known-limitations72308

End Tag Table

View File

@ -1290,6 +1290,37 @@ COMMANDS
The print command also supports output destination and CSV output.
Here's an example of print's CSV output:
"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"
"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""
"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""
"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""
"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""
"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""
"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""
"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""
"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""
"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""
"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
o There is one CSV record per posting, with the parent transaction's
fields repeated.
o The "txnidx" (transaction index) field shows which postings belong to
the same transaction. (This number might change if transactions are
reordered within the file, files are parsed/included in a different
order, etc.)
o The amount is separated into "commodity" (the symbol) and "amount"
(numeric quantity) fields.
o The numeric amount is repeated in either the "credit" or "debit" col-
umn, for convenience. (Those names are not accurate in the account-
ing sense; it just puts negative amounts under credit and zero or
greater amounts under debit.)
register
Show postings and their running total. Alias: reg.