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 and
[CSV output](#csv-output). [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 ## register
Show postings and their running total. Alias: reg. 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. (with \-B/\-\-cost) shows cost amounts.
.PP .PP
The print command also supports output destination and CSV output. 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 .SS register
.PP .PP
Show postings and their running total. 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. 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 File: hledger.1.info, Node: register, Next: stats, Prev: print, Up: COMMANDS
@ -2289,41 +2321,41 @@ Node: man45534
Ref: #man45631 Ref: #man45631
Node: print46034 Node: print46034
Ref: #print46139 Ref: #print46139
Node: register47485 Node: register49249
Ref: #register47598 Ref: #register49362
Node: Custom register output52090 Node: Custom register output53854
Ref: #custom-register-output52221 Ref: #custom-register-output53985
Node: stats53518 Node: stats55282
Ref: #stats53624 Ref: #stats55388
Node: test54504 Node: test56268
Ref: #test54591 Ref: #test56355
Node: ADD-ON COMMANDS54958 Node: ADD-ON COMMANDS56722
Ref: #add-on-commands55094 Ref: #add-on-commands56858
Node: api56382 Node: api58146
Ref: #api56474 Ref: #api58238
Node: autosync56508 Node: autosync58272
Ref: #autosync56623 Ref: #autosync58387
Node: diff58938 Node: diff60702
Ref: #diff59048 Ref: #diff60812
Node: equity59712 Node: equity61476
Ref: #equity59826 Ref: #equity61590
Node: interest61154 Node: interest62918
Ref: #interest61271 Ref: #interest63035
Node: irr64355 Node: irr66119
Ref: #irr64468 Ref: #irr66232
Node: print-unique66843 Node: print-unique68607
Ref: #print-unique66973 Ref: #print-unique68737
Node: rewrite67231 Node: rewrite68995
Ref: #rewrite67350 Ref: #rewrite69114
Node: ui67879 Node: ui69643
Ref: #ui67979 Ref: #ui69743
Node: web68020 Node: web69784
Ref: #web68108 Ref: #web69872
Node: TROUBLESHOOTING68141 Node: TROUBLESHOOTING69905
Ref: #troubleshooting68260 Ref: #troubleshooting70024
Node: Run-time problems68314 Node: Run-time problems70078
Ref: #run-time-problems68457 Ref: #run-time-problems70221
Node: Known limitations70401 Node: Known limitations72165
Ref: #known-limitations70544 Ref: #known-limitations72308
 
End Tag Table End Tag Table

View File

@ -1290,6 +1290,37 @@ COMMANDS
The print command also supports output destination and CSV output. 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 register
Show postings and their running total. Alias: reg. Show postings and their running total. Alias: reg.