From af71a020ff99fb7a8deef3a3ab5deba132dc1ea0 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 10 Jan 2017 12:23:46 -0800 Subject: [PATCH] doc: explain print's CSV output [ci skip] --- hledger/doc/commands.m4.md | 25 +++++++++ hledger/doc/hledger.1 | 35 +++++++++++++ hledger/doc/hledger.1.info | 104 ++++++++++++++++++++++++------------- hledger/doc/hledger.1.txt | 31 +++++++++++ 4 files changed, 159 insertions(+), 36 deletions(-) diff --git a/hledger/doc/commands.m4.md b/hledger/doc/commands.m4.md index 6d7ae1593..b143ac9d1 100644 --- a/hledger/doc/commands.m4.md +++ b/hledger/doc/commands.m4.md @@ -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. diff --git a/hledger/doc/hledger.1 b/hledger/doc/hledger.1 index ab5597377..e8b21f10b 100644 --- a/hledger/doc/hledger.1 +++ b/hledger/doc/hledger.1 @@ -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. diff --git a/hledger/doc/hledger.1.info b/hledger/doc/hledger.1.info index 063e02790..de210fecd 100644 --- a/hledger/doc/hledger.1.info +++ b/hledger/doc/hledger.1.info @@ -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 diff --git a/hledger/doc/hledger.1.txt b/hledger/doc/hledger.1.txt index 1de8d18b2..abaf4568a 100644 --- a/hledger/doc/hledger.1.txt +++ b/hledger/doc/hledger.1.txt @@ -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.