diff --git a/hledger-lib/defs.m4 b/hledger-lib/defs.m4 index 628ffc87b..75ef7d648 100644 --- a/hledger-lib/defs.m4 +++ b/hledger-lib/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.18.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{August 2020}})m4_dnl +m4_define({{_monthyear_}}, {{September 2020}})m4_dnl diff --git a/hledger-lib/hledger_csv.5 b/hledger-lib/hledger_csv.5 index ea6dd2f22..38c1e61da 100644 --- a/hledger-lib/hledger_csv.5 +++ b/hledger-lib/hledger_csv.5 @@ -1,6 +1,6 @@ .\"t -.TH "hledger_csv" "5" "August 2020" "hledger 1.18.99" "hledger User Manuals" +.TH "hledger_csv" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals" @@ -9,9 +9,10 @@ CSV - how hledger reads CSV data, and the CSV rules file format .SH DESCRIPTION .PP -hledger can read CSV (Comma Separated Value/Character Separated Value) -files as if they were journal files, automatically converting each CSV -record into a transaction. +hledger can read CSV files (Character Separated Value - usually comma, +semicolon, or tab) containing dated records as if they were journal +files, automatically converting each CSV record into a transaction. +.PP (To learn about \f[I]writing\f[R] CSV, see CSV output.) .PP We describe each CSV file\[aq]s format with a corresponding \f[I]rules @@ -592,9 +593,19 @@ Interpolation strips outer whitespace (so a CSV value like See TIPS below for more about referencing other fields. .SS \f[C]separator\f[R] .PP -You can use the \f[C]separator\f[R] directive to read other kinds of +You can use the \f[C]separator\f[R] rule to read other kinds of character-separated data. -Eg to read SSV (Semicolon Separated Values), use: +The argument is any single separator character, or the words +\f[C]tab\f[R] or \f[C]space\f[R] (case insensitive). +Eg, for comma-separated values (CSV): +.IP +.nf +\f[C] +separator , +\f[R] +.fi +.PP +or for semicolon-separated values (SSV): .IP .nf \f[C] @@ -602,11 +613,7 @@ separator ; \f[R] .fi .PP -The separator directive accepts exactly one single byte character as a -separator. -To specify whitespace characters, you may use the special words -\f[C]TAB\f[R] or \f[C]SPACE\f[R]. -Eg to read TSV (Tab Separated Values), use: +or for tab-separated values (TSV): .IP .nf \f[C] @@ -614,7 +621,10 @@ separator TAB \f[R] .fi .PP -See also: File Extension. +If the input file has a \f[C].csv\f[R], \f[C].ssv\f[R] or \f[C].tsv\f[R] +file extension (or a \f[C]csv:\f[R], \f[C]ssv:\f[R], \f[C]tsv:\f[R] +prefix), the appropriate separator will be inferred automatically, and +you won\[aq]t need this rule. .SS \f[C]if\f[R] block .IP .nf @@ -964,14 +974,12 @@ they must be double quotes (not single quotes) spaces outside the quotes are not allowed .SS File Extension .PP -CSV (\[dq]Character Separated Values\[dq]) files should be named with -one of these filename extensions: \f[C].csv\f[R], \f[C].ssv\f[R], -\f[C].tsv\f[R]. -Or, the file path should be prefixed with one of \f[C]csv:\f[R], -\f[C]ssv:\f[R], \f[C]tsv:\f[R]. -This helps hledger identify the format and show the right error -messages. -For example: +To help hledger identify the format and show the right error messages, +CSV/SSV/TSV files should normally be named with a \f[C].csv\f[R], +\f[C].ssv\f[R] or \f[C].tsv\f[R] filename extension. +Or, the file path should be prefixed with \f[C]csv:\f[R], \f[C]ssv:\f[R] +or \f[C]tsv:\f[R]. +Eg: .IP .nf \f[C] @@ -987,7 +995,8 @@ $ cat foo | hledger -f ssv:- foo \f[R] .fi .PP -More about this: Input files in the hledger manual. +You can override the file extension with a separator rule if needed. +See also: Input files in the hledger manual. .SS Reading multiple CSV files .PP If you use multiple \f[C]-f\f[R] options to read multiple CSV files at diff --git a/hledger-lib/hledger_csv.info b/hledger-lib/hledger_csv.info index e6c61cd61..e1bc22749 100644 --- a/hledger-lib/hledger_csv.info +++ b/hledger-lib/hledger_csv.info @@ -8,10 +8,12 @@ hledger_csv(5) hledger 1.18.99 CSV - how hledger reads CSV data, and the CSV rules file format - hledger can read CSV (Comma Separated Value/Character Separated -Value) files as if they were journal files, automatically converting -each CSV record into a transaction. (To learn about _writing_ CSV, see -CSV output.) + hledger can read CSV files (Character Separated Value - usually +comma, semicolon, or tab) containing dated records as if they were +journal files, automatically converting each CSV record into a +transaction. + + (To learn about _writing_ CSV, see CSV output.) We describe each CSV file's format with a corresponding _rules file_. By default this is named like the CSV file with a '.rules' extension @@ -580,19 +582,24 @@ File: hledger_csv.info, Node: separator, Next: if block, Prev: field assignme 2.4 'separator' =============== -You can use the 'separator' directive to read other kinds of -character-separated data. Eg to read SSV (Semicolon Separated Values), -use: +You can use the 'separator' rule to read other kinds of +character-separated data. The argument is any single separator +character, or the words 'tab' or 'space' (case insensitive). Eg, for +comma-separated values (CSV): + +separator , + + or for semicolon-separated values (SSV): separator ; - The separator directive accepts exactly one single byte character as -a separator. To specify whitespace characters, you may use the special -words 'TAB' or 'SPACE'. Eg to read TSV (Tab Separated Values), use: + or for tab-separated values (TSV): separator TAB - See also: File Extension. + If the input file has a '.csv', '.ssv' or '.tsv' file extension (or a +'csv:', 'ssv:', 'tsv:' prefix), the appropriate separator will be +inferred automatically, and you won't need this rule.  File: hledger_csv.info, Node: if block, Next: if table, Prev: separator, Up: CSV RULES @@ -932,11 +939,10 @@ File: hledger_csv.info, Node: File Extension, Next: Reading multiple CSV files 3.3 File Extension ================== -CSV ("Character Separated Values") files should be named with one of -these filename extensions: '.csv', '.ssv', '.tsv'. Or, the file path -should be prefixed with one of 'csv:', 'ssv:', 'tsv:'. This helps -hledger identify the format and show the right error messages. For -example: +To help hledger identify the format and show the right error messages, +CSV/SSV/TSV files should normally be named with a '.csv', '.ssv' or +'.tsv' filename extension. Or, the file path should be prefixed with +'csv:', 'ssv:' or 'tsv:'. Eg: $ hledger -f foo.ssv print @@ -944,7 +950,8 @@ $ hledger -f foo.ssv print $ cat foo | hledger -f ssv:- foo - More about this: Input files in the hledger manual. + You can override the file extension with a separator rule if needed. +See also: Input files in the hledger manual.  File: hledger_csv.info, Node: Reading multiple CSV files, Next: Valid transactions, Prev: File Extension, Up: TIPS @@ -1143,84 +1150,84 @@ command the user specified.  Tag Table: Node: Top72 -Node: EXAMPLES2636 -Ref: #examples2742 -Node: Basic2950 -Ref: #basic3050 -Node: Bank of Ireland3592 -Ref: #bank-of-ireland3727 -Node: Amazon5189 -Ref: #amazon5307 -Node: Paypal7026 -Ref: #paypal7120 -Node: CSV RULES14764 -Ref: #csv-rules14873 -Node: skip15168 -Ref: #skip15261 -Node: fields15636 -Ref: #fields15758 -Node: Transaction field names16923 -Ref: #transaction-field-names17083 -Node: Posting field names17194 -Ref: #posting-field-names17346 -Node: account17416 -Ref: #account17532 -Node: amount18069 -Ref: #amount18200 -Node: currency19307 -Ref: #currency19442 -Node: balance19648 -Ref: #balance19782 -Node: comment20099 -Ref: #comment20216 -Node: field assignment20379 -Ref: #field-assignment20522 -Node: separator21340 -Ref: #separator21475 -Node: if block21886 -Ref: #if-block22011 -Node: Matching the whole record22412 -Ref: #matching-the-whole-record22587 -Node: Matching individual fields23391 -Ref: #matching-individual-fields23595 -Node: Combining matchers23819 -Ref: #combining-matchers24015 -Node: Rules applied on successful match24328 -Ref: #rules-applied-on-successful-match24519 -Node: if table25173 -Ref: #if-table25292 -Node: end27030 -Ref: #end27142 -Node: date-format27366 -Ref: #date-format27498 -Node: newest-first28247 -Ref: #newest-first28385 -Node: include29068 -Ref: #include29199 -Node: balance-type29643 -Ref: #balance-type29763 -Node: TIPS30463 -Ref: #tips30545 -Node: Rapid feedback30801 -Ref: #rapid-feedback30918 -Node: Valid CSV31378 -Ref: #valid-csv31508 -Node: File Extension31700 -Ref: #file-extension31852 -Node: Reading multiple CSV files32262 -Ref: #reading-multiple-csv-files32447 -Node: Valid transactions32688 -Ref: #valid-transactions32866 -Node: Deduplicating importing33494 -Ref: #deduplicating-importing33673 -Node: Setting amounts34706 -Ref: #setting-amounts34875 -Node: Setting currency/commodity35862 -Ref: #setting-currencycommodity36054 -Node: Referencing other fields36857 -Ref: #referencing-other-fields37057 -Node: How CSV rules are evaluated37954 -Ref: #how-csv-rules-are-evaluated38127 +Node: EXAMPLES2677 +Ref: #examples2783 +Node: Basic2991 +Ref: #basic3091 +Node: Bank of Ireland3633 +Ref: #bank-of-ireland3768 +Node: Amazon5230 +Ref: #amazon5348 +Node: Paypal7067 +Ref: #paypal7161 +Node: CSV RULES14805 +Ref: #csv-rules14914 +Node: skip15209 +Ref: #skip15302 +Node: fields15677 +Ref: #fields15799 +Node: Transaction field names16964 +Ref: #transaction-field-names17124 +Node: Posting field names17235 +Ref: #posting-field-names17387 +Node: account17457 +Ref: #account17573 +Node: amount18110 +Ref: #amount18241 +Node: currency19348 +Ref: #currency19483 +Node: balance19689 +Ref: #balance19823 +Node: comment20140 +Ref: #comment20257 +Node: field assignment20420 +Ref: #field-assignment20563 +Node: separator21381 +Ref: #separator21516 +Node: if block22056 +Ref: #if-block22181 +Node: Matching the whole record22582 +Ref: #matching-the-whole-record22757 +Node: Matching individual fields23561 +Ref: #matching-individual-fields23765 +Node: Combining matchers23989 +Ref: #combining-matchers24185 +Node: Rules applied on successful match24498 +Ref: #rules-applied-on-successful-match24689 +Node: if table25343 +Ref: #if-table25462 +Node: end27200 +Ref: #end27312 +Node: date-format27536 +Ref: #date-format27668 +Node: newest-first28417 +Ref: #newest-first28555 +Node: include29238 +Ref: #include29369 +Node: balance-type29813 +Ref: #balance-type29933 +Node: TIPS30633 +Ref: #tips30715 +Node: Rapid feedback30971 +Ref: #rapid-feedback31088 +Node: Valid CSV31548 +Ref: #valid-csv31678 +Node: File Extension31870 +Ref: #file-extension32022 +Node: Reading multiple CSV files32451 +Ref: #reading-multiple-csv-files32636 +Node: Valid transactions32877 +Ref: #valid-transactions33055 +Node: Deduplicating importing33683 +Ref: #deduplicating-importing33862 +Node: Setting amounts34895 +Ref: #setting-amounts35064 +Node: Setting currency/commodity36051 +Ref: #setting-currencycommodity36243 +Node: Referencing other fields37046 +Ref: #referencing-other-fields37246 +Node: How CSV rules are evaluated38143 +Ref: #how-csv-rules-are-evaluated38316  End Tag Table diff --git a/hledger-lib/hledger_csv.txt b/hledger-lib/hledger_csv.txt index 5aebdaa41..d030bc473 100644 --- a/hledger-lib/hledger_csv.txt +++ b/hledger-lib/hledger_csv.txt @@ -7,19 +7,20 @@ NAME CSV - how hledger reads CSV data, and the CSV rules file format DESCRIPTION - hledger can read CSV (Comma Separated Value/Character Separated Value) - files as if they were journal files, automatically converting each CSV - record into a transaction. (To learn about writing CSV, see CSV out- - put.) + hledger can read CSV files (Character Separated Value - usually comma, + semicolon, or tab) containing dated records as if they were journal + files, automatically converting each CSV record into a transaction. + + (To learn about writing CSV, see CSV output.) We describe each CSV file's format with a corresponding rules file. By - default this is named like the CSV file with a .rules extension added. - Eg when reading FILE.csv, hledger also looks for FILE.csv.rules in the - same directory as FILE.csv. You can specify a different rules file - with the --rules-file option. If a rules file is not found, hledger + default this is named like the CSV file with a .rules extension added. + Eg when reading FILE.csv, hledger also looks for FILE.csv.rules in the + same directory as FILE.csv. You can specify a different rules file + with the --rules-file option. If a rules file is not found, hledger will create a sample rules file, which you'll need to adjust. - This file contains rules describing the CSV data (header line, fields + This file contains rules describing the CSV data (header line, fields layout, date format etc.), and how to construct hledger journal entries (transactions) from it. Often there will also be a list of conditional rules for categorising transactions based on their descriptions. @@ -28,36 +29,36 @@ DESCRIPTION skip skip one or more header lines or matched CSV records - fields name CSV fields, assign them to hledger + fields name CSV fields, assign them to hledger fields - field assignment assign a value to one hledger field, + field assignment assign a value to one hledger field, with interpolation separator a custom field separator - if block apply some rules to CSV records matched + if block apply some rules to CSV records matched by patterns - if table apply some rules to CSV records matched + if table apply some rules to CSV records matched by patterns, alternate syntax end skip the remaining CSV records date-format describe the format of CSV dates - newest-first disambiguate record order when there's + newest-first disambiguate record order when there's only one date include inline another CSV rules file balance-type choose which type of balance assignments to use - Note, for best error messages when reading CSV files, use a .csv, .tsv + Note, for best error messages when reading CSV files, use a .csv, .tsv or .ssv file extension or file prefix - see File Extension below. There's an introductory Convert CSV files tutorial on hledger.org. EXAMPLES - Here are some sample hledger CSV rules files. See also the full col- + Here are some sample hledger CSV rules files. See also the full col- lection at: https://github.com/simonmichael/hledger/tree/master/examples/csv Basic - At minimum, the rules file must identify the date and amount fields, - and often it also specifies the date format and how many header lines + At minimum, the rules file must identify the date and amount fields, + and often it also specifies the date format and how many header lines there are. Here's a simple CSV file and a rules file for it: Date, Description, Id, Amount @@ -76,8 +77,8 @@ EXAMPLES Default account names are chosen, since we didn't set them. Bank of Ireland - Here's a CSV with two amount fields (Debit and Credit), and a balance - field, which we can use to add balance assertions, which is not neces- + Here's a CSV with two amount fields (Debit and Credit), and a balance + field, which we can use to add balance assertions, which is not neces- sary but provides extra error checking: Date,Details,Debit,Credit,Balance @@ -119,13 +120,13 @@ EXAMPLES assets:bank:boi:checking EUR-5.0 = EUR126.0 expenses:unknown EUR5.0 - The balance assertions don't raise an error above, because we're read- - ing directly from CSV, but they will be checked if these entries are + The balance assertions don't raise an error above, because we're read- + ing directly from CSV, but they will be checked if these entries are imported into a journal file. Amazon Here we convert amazon.com order history, and use an if block to gener- - ate a third posting if there's a fee. (In practice you'd probably get + ate a third posting if there's a fee. (In practice you'd probably get this data from your bank instead, but it's an example.) "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID" @@ -177,7 +178,7 @@ EXAMPLES expenses:fees $1.00 Paypal - Here's a real-world rules file for (customised) Paypal CSV, with some + Here's a real-world rules file for (customised) Paypal CSV, with some Paypal-specific rules, and a second rules file included: "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note" @@ -332,9 +333,9 @@ CSV RULES skip skip N - The word "skip" followed by a number (or no number, meaning 1) tells - hledger to ignore this many non-empty lines preceding the CSV data. - (Empty/blank lines are skipped automatically.) You'll need this when- + The word "skip" followed by a number (or no number, meaning 1) tells + hledger to ignore this many non-empty lines preceding the CSV data. + (Empty/blank lines are skipped automatically.) You'll need this when- ever your CSV data contains header lines. It also has a second purpose: it can be used inside if blocks to ignore @@ -343,27 +344,27 @@ CSV RULES fields fields FIELDNAME1, FIELDNAME2, ... - A fields list (the word "fields" followed by comma-separated field - names) is the quick way to assign CSV field values to hledger fields. + A fields list (the word "fields" followed by comma-separated field + names) is the quick way to assign CSV field values to hledger fields. It does two things: - 1. it names the CSV fields. This is optional, but can be convenient + 1. it names the CSV fields. This is optional, but can be convenient later for interpolating them. 2. when you use a standard hledger field name, it assigns the CSV value to that part of the hledger transaction. - Here's an example that says "use the 1st, 2nd and 4th fields as the - transaction's date, description and amount; name the last two fields + Here's an example that says "use the 1st, 2nd and 4th fields as the + transaction's date, description and amount; name the last two fields for later reference; and ignore the others": fields date, description, , amount, , , somefield, anotherfield - Field names may not contain whitespace. Fields you don't care about - can be left unnamed. Currently there must be least two items (there + Field names may not contain whitespace. Fields you don't care about + can be left unnamed. Currently there must be least two items (there must be at least one comma). - Note, always use comma in the fields list, even if your CSV uses an- + Note, always use comma in the fields list, even if your CSV uses an- other separator character. Here are the standard hledger field/pseudo-field names. For more about @@ -376,52 +377,52 @@ CSV RULES Posting field names account - accountN, where N is 1 to 99, causes a posting to be generated, with + accountN, where N is 1 to 99, causes a posting to be generated, with that account name. - Most often there are two postings, so you'll want to set account1 and - account2. Typically account1 is associated with the CSV file, and is - set once with a top-level assignment, while account2 is set based on + Most often there are two postings, so you'll want to set account1 and + account2. Typically account1 is associated with the CSV file, and is + set once with a top-level assignment, while account2 is set based on each transaction's description, and in conditional blocks. - If a posting's account name is left unset but its amount is set (see - below), a default account name will be chosen (like "expenses:unknown" + If a posting's account name is left unset but its amount is set (see + below), a default account name will be chosen (like "expenses:unknown" or "income:unknown"). amount - amountN sets posting N's amount. If the CSV uses separate fields for - inflows and outflows, you can use amountN-in and amountN-out instead. - By assigning to amount1, amount2, ... etc. you can generate anywhere + amountN sets posting N's amount. If the CSV uses separate fields for + inflows and outflows, you can use amountN-in and amountN-out instead. + By assigning to amount1, amount2, ... etc. you can generate anywhere from 0 to 99 postings. - There is also an older, unnumbered form of these names, suitable for + There is also an older, unnumbered form of these names, suitable for 2-posting transactions, which sets both posting 1's and (negated) post- - ing 2's amount: amount, or amount-in and amount-out. This is still - supported because it keeps pre-hledger-1.17 csv rules files working, - and because it can be more succinct, and because it converts posting + ing 2's amount: amount, or amount-in and amount-out. This is still + supported because it keeps pre-hledger-1.17 csv rules files working, + and because it can be more succinct, and because it converts posting 2's amount to cost if there's a transaction price, which can be useful. If you have an existing rules file using the unnumbered form, you might - want to use the numbered form in certain conditional blocks, without - having to update and retest all the old rules. To facilitate this, - posting 1 ignores amount/amount-in/amount-out if any of + want to use the numbered form in certain conditional blocks, without + having to update and retest all the old rules. To facilitate this, + posting 1 ignores amount/amount-in/amount-out if any of amount1/amount1-in/amount1-out are assigned, and posting 2 ignores them - if any of amount2/amount2-in/amount2-out are assigned, avoiding con- + if any of amount2/amount2-in/amount2-out are assigned, avoiding con- flicts. currency If the CSV has the currency symbol in a separate field (ie, not part of - the amount field), you can use currencyN to prepend it to posting N's + the amount field), you can use currencyN to prepend it to posting N's amount. Or, currency with no number affects all postings. balance - balanceN sets a balance assertion amount (or if the posting amount is + balanceN sets a balance assertion amount (or if the posting amount is left empty, a balance assignment) on posting N. - Also, for compatibility with hledger <1.17: balance with no number is + Also, for compatibility with hledger <1.17: balance with no number is equivalent to balance1. - You can adjust the type of assertion/assignment with the balance-type + You can adjust the type of assertion/assignment with the balance-type rule (see below). comment @@ -433,11 +434,11 @@ CSV RULES field assignment HLEDGERFIELDNAME FIELDVALUE - Instead of or in addition to a fields list, you can use a "field as- - signment" rule to set the value of a single hledger field, by writing - its name (any of the standard hledger field names above) followed by a - text value. The value may contain interpolated CSV fields, referenced - by their 1-based position in the CSV record (%N), or by the name they + Instead of or in addition to a fields list, you can use a "field as- + signment" rule to set the value of a single hledger field, by writing + its name (any of the standard hledger field names above) followed by a + text value. The value may contain interpolated CSV fields, referenced + by their 1-based position in the CSV record (%N), or by the name they were given in the fields list (%CSVFIELDNAME). Some examples: # set the amount to the 4th CSV field, with " USD" appended @@ -446,23 +447,29 @@ CSV RULES # combine three fields to make a comment, containing note: and date: tags comment note: %somefield - %anotherfield, date: %1 - Interpolation strips outer whitespace (so a CSV value like " 1 " be- + Interpolation strips outer whitespace (so a CSV value like " 1 " be- comes 1 when interpolated) (#1051). See TIPS below for more about ref- erencing other fields. separator - You can use the separator directive to read other kinds of character- - separated data. Eg to read SSV (Semicolon Separated Values), use: + You can use the separator rule to read other kinds of character-sepa- + rated data. The argument is any single separator character, or the + words tab or space (case insensitive). Eg, for comma-separated values + (CSV): + + separator , + + or for semicolon-separated values (SSV): separator ; - The separator directive accepts exactly one single byte character as a - separator. To specify whitespace characters, you may use the special - words TAB or SPACE. Eg to read TSV (Tab Separated Values), use: + or for tab-separated values (TSV): separator TAB - See also: File Extension. + If the input file has a .csv, .ssv or .tsv file extension (or a csv:, + ssv:, tsv: prefix), the appropriate separator will be inferred automat- + ically, and you won't need this rule. if block if MATCHER @@ -475,8 +482,8 @@ CSV RULES RULE RULE - Conditional blocks ("if blocks") are a block of rules that are applied - only to CSV records which match certain patterns. They are often used + Conditional blocks ("if blocks") are a block of rules that are applied + only to CSV records which match certain patterns. They are often used for customising account names based on transaction descriptions. Matching the whole record @@ -484,16 +491,16 @@ CSV RULES REGEX - REGEX is a case-insensitive regular expression which tries to match - anywhere within the CSV record. It is a POSIX ERE (extended regular - expression) that also supports GNU word boundaries (\b, \B, \<, \>), + REGEX is a case-insensitive regular expression which tries to match + anywhere within the CSV record. It is a POSIX ERE (extended regular + expression) that also supports GNU word boundaries (\b, \B, \<, \>), and nothing else. If you have trouble, be sure to check our https://hledger.org/hledger.html#regular-expressions doc. - Important note: the record that is matched is not the original record, - but a synthetic one, with any enclosing double quotes (but not enclos- + Important note: the record that is matched is not the original record, + but a synthetic one, with any enclosing double quotes (but not enclos- ing whitespace) removed, and always comma-separated (which means that a - field containing a comma will appear like two fields). Eg, if the + field containing a comma will appear like two fields). Eg, if the original record is 2020-01-01; "Acme, Inc."; 1,000, the REGEX will ac- tually see 2020-01-01,Acme, Inc., 1,000). @@ -502,14 +509,14 @@ CSV RULES %CSVFIELD REGEX - which matches just the content of a particular CSV field. CSVFIELD is - a percent sign followed by the field's name or column number, like + which matches just the content of a particular CSV field. CSVFIELD is + a percent sign followed by the field's name or column number, like %date or %1. Combining matchers A single matcher can be written on the same line as the "if"; or multi- ple matchers can be written on the following lines, non-indented. Mul- - tiple matchers are OR'd (any one of them can match), unless one begins + tiple matchers are OR'd (any one of them can match), unless one begins with an & symbol, in which case it is AND'ed with the previous matcher. if @@ -518,8 +525,8 @@ CSV RULES RULE Rules applied on successful match - After the patterns there should be one or more rules to apply, all in- - dented by at least one space. Three kinds of rule are allowed in con- + After the patterns there should be one or more rules to apply, all in- + dented by at least one space. Three kinds of rule are allowed in con- ditional blocks: o field assignments (to set a hledger field) @@ -549,11 +556,11 @@ CSV RULES MATCHER3,VALUE31,VALUE32,...,VALUE3n - Conditional tables ("if tables") are a different syntax to specify - field assignments that will be applied only to CSV records which match + Conditional tables ("if tables") are a different syntax to specify + field assignments that will be applied only to CSV records which match certain patterns. - MATCHER could be either field or record matcher, as described above. + MATCHER could be either field or record matcher, as described above. When MATCHER matches, values from that row would be assigned to the CSV fields named on the if line, in the same order. @@ -577,17 +584,17 @@ CSV RULES ... CSVFIELDNAMEn VALUE3n - Each line starting with MATCHER should contain enough (possibly empty) + Each line starting with MATCHER should contain enough (possibly empty) values for all the listed fields. - Rules would be checked and applied in the order they are listed in the + Rules would be checked and applied in the order they are listed in the table and, like with if blocks, later rules (in the same or another ta- ble) or if blocks could override the effect of any rule. - Instead of ',' you can use a variety of other non-alphanumeric charac- + Instead of ',' you can use a variety of other non-alphanumeric charac- ters as a separator. First character after if is taken to be the sepa- - rator for the rest of the table. It is the responsibility of the user - to ensure that separator does not occur inside MATCHERs and values - + rator for the rest of the table. It is the responsibility of the user + to ensure that separator does not occur inside MATCHERs and values - there is no way to escape separator. Example: @@ -598,7 +605,7 @@ CSV RULES 2020/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call-out end - This rule can be used inside if blocks (only), to make hledger stop + This rule can be used inside if blocks (only), to make hledger stop reading this CSV file and move on to the next input file, or to command execution. Eg: @@ -609,10 +616,10 @@ CSV RULES date-format date-format DATEFMT - This is a helper for the date (and date2) fields. If your CSV dates - are not formatted like YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll - need to add a date-format rule describing them with a strptime date - parsing pattern, which must parse the CSV date value completely. Some + This is a helper for the date (and date2) fields. If your CSV dates + are not formatted like YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll + need to add a date-format rule describing them with a strptime date + parsing pattern, which must parse the CSV date value completely. Some examples: # MM/DD/YY @@ -634,15 +641,15 @@ CSV RULES mat.html#v:formatTime newest-first - hledger always sorts the generated transactions by date. Transactions - on the same date should appear in the same order as their CSV records, - as hledger can usually auto-detect whether the CSV's normal order is + hledger always sorts the generated transactions by date. Transactions + on the same date should appear in the same order as their CSV records, + as hledger can usually auto-detect whether the CSV's normal order is oldest first or newest first. But if all of the following are true: - o the CSV might sometimes contain just one day of data (all records + o the CSV might sometimes contain just one day of data (all records having the same date) - o the CSV records are normally in reverse chronological order (newest + o the CSV records are normally in reverse chronological order (newest at the top) o and you care about preserving the order of same-day transactions @@ -655,9 +662,9 @@ CSV RULES include include RULESFILE - This includes the contents of another CSV rules file at this point. - RULESFILE is an absolute file path or a path relative to the current - file's directory. This can be useful for sharing common rules between + This includes the contents of another CSV rules file at this point. + RULESFILE is an absolute file path or a path relative to the current + file's directory. This can be useful for sharing common rules between several rules files, eg: # someaccount.csv.rules @@ -672,10 +679,10 @@ CSV RULES balance-type Balance assertions generated by assigning to balanceN are of the simple - = type by default, which is a single-commodity, subaccount-excluding + = type by default, which is a single-commodity, subaccount-excluding assertion. You may find the subaccount-including variants more useful, - eg if you have created some virtual subaccounts of checking to help - with budgeting. You can select a different type of assertion with the + eg if you have created some virtual subaccounts of checking to help + with budgeting. You can select a different type of assertion with the balance-type rule: # balance assertions will consider all commodities and all subaccounts @@ -690,19 +697,19 @@ CSV RULES TIPS Rapid feedback - It's a good idea to get rapid feedback while creating/troubleshooting + It's a good idea to get rapid feedback while creating/troubleshooting CSV rules. Here's a good way, using entr from http://eradman.com/entr- project : $ ls foo.csv* | entr bash -c 'echo ----; hledger -f foo.csv print desc:SOMEDESC' - A desc: query (eg) is used to select just one, or a few, transactions - of interest. "bash -c" is used to run multiple commands, so we can - echo a separator each time the command re-runs, making it easier to + A desc: query (eg) is used to select just one, or a few, transactions + of interest. "bash -c" is used to run multiple commands, so we can + echo a separator each time the command re-runs, making it easier to read the output. Valid CSV - hledger accepts CSV conforming to RFC 4180. When CSV values are en- + hledger accepts CSV conforming to RFC 4180. When CSV values are en- closed in quotes, note: o they must be double quotes (not single quotes) @@ -710,10 +717,10 @@ TIPS o spaces outside the quotes are not allowed File Extension - CSV ("Character Separated Values") files should be named with one of - these filename extensions: .csv, .ssv, .tsv. Or, the file path should - be prefixed with one of csv:, ssv:, tsv:. This helps hledger identify - the format and show the right error messages. For example: + To help hledger identify the format and show the right error messages, + CSV/SSV/TSV files should normally be named with a .csv, .ssv or .tsv + filename extension. Or, the file path should be prefixed with csv:, + ssv: or tsv:. Eg: $ hledger -f foo.ssv print @@ -721,7 +728,8 @@ TIPS $ cat foo | hledger -f ssv:- foo - More about this: Input files in the hledger manual. + You can override the file extension with a separator rule if needed. + See also: Input files in the hledger manual. Reading multiple CSV files If you use multiple -f options to read multiple CSV files at once, @@ -914,4 +922,4 @@ SEE ALSO -hledger 1.18.99 August 2020 hledger_csv(5) +hledger 1.18.99 September 2020 hledger_csv(5) diff --git a/hledger-lib/hledger_journal.5 b/hledger-lib/hledger_journal.5 index 0c40725b9..8cd084c02 100644 --- a/hledger-lib/hledger_journal.5 +++ b/hledger-lib/hledger_journal.5 @@ -1,6 +1,6 @@ .\"t -.TH "hledger_journal" "5" "August 2020" "hledger 1.18.99" "hledger User Manuals" +.TH "hledger_journal" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals" diff --git a/hledger-lib/hledger_journal.txt b/hledger-lib/hledger_journal.txt index 2cd7cc5fa..d1e27d166 100644 --- a/hledger-lib/hledger_journal.txt +++ b/hledger-lib/hledger_journal.txt @@ -1526,4 +1526,4 @@ SEE ALSO -hledger 1.18.99 August 2020 hledger_journal(5) +hledger 1.18.99 September 2020 hledger_journal(5) diff --git a/hledger-lib/hledger_timeclock.5 b/hledger-lib/hledger_timeclock.5 index 5301c8749..f85c21192 100644 --- a/hledger-lib/hledger_timeclock.5 +++ b/hledger-lib/hledger_timeclock.5 @@ -1,5 +1,5 @@ -.TH "hledger_timeclock" "5" "August 2020" "hledger 1.18.99" "hledger User Manuals" +.TH "hledger_timeclock" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals" diff --git a/hledger-lib/hledger_timeclock.txt b/hledger-lib/hledger_timeclock.txt index 3ddc77d3f..27650d252 100644 --- a/hledger-lib/hledger_timeclock.txt +++ b/hledger-lib/hledger_timeclock.txt @@ -78,4 +78,4 @@ SEE ALSO -hledger 1.18.99 August 2020 hledger_timeclock(5) +hledger 1.18.99 September 2020 hledger_timeclock(5) diff --git a/hledger-lib/hledger_timedot.5 b/hledger-lib/hledger_timedot.5 index df97a7e60..84dda8de0 100644 --- a/hledger-lib/hledger_timedot.5 +++ b/hledger-lib/hledger_timedot.5 @@ -1,5 +1,5 @@ -.TH "hledger_timedot" "5" "August 2020" "hledger 1.18.99" "hledger User Manuals" +.TH "hledger_timedot" "5" "September 2020" "hledger 1.18.99" "hledger User Manuals" diff --git a/hledger-lib/hledger_timedot.txt b/hledger-lib/hledger_timedot.txt index 768a25019..cb0d096b7 100644 --- a/hledger-lib/hledger_timedot.txt +++ b/hledger-lib/hledger_timedot.txt @@ -161,4 +161,4 @@ SEE ALSO -hledger 1.18.99 August 2020 hledger_timedot(5) +hledger 1.18.99 September 2020 hledger_timedot(5) diff --git a/hledger-ui/defs.m4 b/hledger-ui/defs.m4 index 628ffc87b..75ef7d648 100644 --- a/hledger-ui/defs.m4 +++ b/hledger-ui/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.18.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{August 2020}})m4_dnl +m4_define({{_monthyear_}}, {{September 2020}})m4_dnl diff --git a/hledger-ui/hledger-ui.1 b/hledger-ui/hledger-ui.1 index 6b0e6f7a4..303d997fa 100644 --- a/hledger-ui/hledger-ui.1 +++ b/hledger-ui/hledger-ui.1 @@ -1,5 +1,5 @@ -.TH "hledger-ui" "1" "August 2020" "hledger-ui 1.18.99" "hledger User Manuals" +.TH "hledger-ui" "1" "September 2020" "hledger-ui 1.18.99" "hledger User Manuals" diff --git a/hledger-ui/hledger-ui.txt b/hledger-ui/hledger-ui.txt index 84e0727bf..abda5d52b 100644 --- a/hledger-ui/hledger-ui.txt +++ b/hledger-ui/hledger-ui.txt @@ -456,4 +456,4 @@ SEE ALSO -hledger-ui 1.18.99 August 2020 hledger-ui(1) +hledger-ui 1.18.99 September 2020 hledger-ui(1) diff --git a/hledger-web/defs.m4 b/hledger-web/defs.m4 index 628ffc87b..75ef7d648 100644 --- a/hledger-web/defs.m4 +++ b/hledger-web/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.18.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{August 2020}})m4_dnl +m4_define({{_monthyear_}}, {{September 2020}})m4_dnl diff --git a/hledger-web/hledger-web.1 b/hledger-web/hledger-web.1 index 03d144890..85b0f72b5 100644 --- a/hledger-web/hledger-web.1 +++ b/hledger-web/hledger-web.1 @@ -1,5 +1,5 @@ -.TH "hledger-web" "1" "August 2020" "hledger-web 1.18.99" "hledger User Manuals" +.TH "hledger-web" "1" "September 2020" "hledger-web 1.18.99" "hledger User Manuals" diff --git a/hledger-web/hledger-web.txt b/hledger-web/hledger-web.txt index 5d2cab2f8..9c84ddeca 100644 --- a/hledger-web/hledger-web.txt +++ b/hledger-web/hledger-web.txt @@ -545,4 +545,4 @@ SEE ALSO -hledger-web 1.18.99 August 2020 hledger-web(1) +hledger-web 1.18.99 September 2020 hledger-web(1) diff --git a/hledger/Hledger/Cli/Commands/Balance.txt b/hledger/Hledger/Cli/Commands/Balance.txt index 3f94b559b..16ff0d7f1 100644 --- a/hledger/Hledger/Cli/Commands/Balance.txt +++ b/hledger/Hledger/Cli/Commands/Balance.txt @@ -47,8 +47,7 @@ $ hledger balance By default, accounts are displayed hierarchically, with subaccounts indented below their parent. At each level of the tree, accounts are sorted by account code if any, then by account name. Or with --S/--sort-amount, by their balance amount, largest first. (Note: -S has -a problem in hledger 1.11-1.18). +-S/--sort-amount, by their balance amount, largest first. "Boring" accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more diff --git a/hledger/defs.m4 b/hledger/defs.m4 index 628ffc87b..75ef7d648 100644 --- a/hledger/defs.m4 +++ b/hledger/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.18.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{August 2020}})m4_dnl +m4_define({{_monthyear_}}, {{September 2020}})m4_dnl diff --git a/hledger/hledger.1 b/hledger/hledger.1 index 766236d5b..894639be2 100644 --- a/hledger/hledger.1 +++ b/hledger/hledger.1 @@ -1,6 +1,6 @@ .\"t -.TH "hledger" "1" "August 2020" "hledger 1.18.99" "hledger User Manuals" +.TH "hledger" "1" "September 2020" "hledger 1.18.99" "hledger User Manuals" @@ -982,15 +982,12 @@ $ cat some.journal | hledger -f- \f[R] .fi .PP -Usually the data file is in hledger\[aq]s journal format, but it can -also be one of several other formats, listed below. -hledger detects the format automatically based on the file extension, or -if that is not recognised, by trying each built-in \[dq]reader\[dq] in -turn: +Usually the data file is in hledger\[aq]s journal format, but it can be +in any of the supported file formats, which currently are: .PP .TS tab(@); -lw(7.6n) lw(31.2n) lw(31.2n). +lw(7.8n) lw(39.5n) lw(22.7n). T{ Reader: T}@T{ @@ -1002,37 +999,45 @@ _ T{ \f[C]journal\f[R] T}@T{ -hledger\[aq]s journal format, also some Ledger journals +hledger journal files and some Ledger journals, for transactions T}@T{ \f[C].journal\f[R] \f[C].j\f[R] \f[C].hledger\f[R] \f[C].ledger\f[R] T} T{ \f[C]timeclock\f[R] T}@T{ -timeclock files (precise time logging) +timeclock files, for precise time logging T}@T{ \f[C].timeclock\f[R] T} T{ \f[C]timedot\f[R] T}@T{ -timedot files (approximate time logging) +timedot files, for approximate time logging T}@T{ \f[C].timedot\f[R] T} T{ \f[C]csv\f[R] T}@T{ -comma-separated values (data interchange) +comma/semicolon/tab/other-separated values, for data import T}@T{ -\f[C].csv\f[R] +\f[C].csv\f[R] \f[C].ssv\f[R] \f[C].tsv\f[R] T} .TE .PP -If needed (eg to ensure correct error messages when a file has the -\[dq]wrong\[dq] extension), you can force a specific reader/format by -prepending it to the file path with a colon. -Examples: +hledger detects the format automatically based on the file extensions +shown above. +If it can\[aq]t recognise the file extension, it assumes +\f[C]journal\f[R] format. +So for non-journal files, it\[aq]s important to use a recognised file +extension, so as to either read successfully or to show relevant error +messages. +.PP +When you can\[aq]t ensure the right file extension, not to worry: you +can force a specific reader/format by prefixing the file path with the +format and a colon. +Eg to read a .dat file as csv: .IP .nf \f[C] @@ -1041,16 +1046,20 @@ $ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:- \f[R] .fi .PP -You can also specify multiple \f[C]-f\f[R] options, to read multiple -files as one big journal. +You can specify multiple \f[C]-f\f[R] options, to read multiple files as +one big journal. There are some limitations with this: .IP \[bu] 2 directives in one file will not affect the other files .IP \[bu] 2 balance assertions will not see any account balances from previous files .PP -If you need those, either use the include directive, or concatenate the -files, eg: \f[C]cat a.journal b.journal | hledger -f- CMD\f[R]. +If you need either of those things, you can +.IP \[bu] 2 +use a single parent file which includes the others +.IP \[bu] 2 +or concatenate the files into one before reading, eg: +\f[C]cat a.journal b.journal | hledger -f- CMD\f[R]. .SS Output destination .PP hledger commands send their output to the terminal by default. @@ -2676,7 +2685,6 @@ At each level of the tree, accounts are sorted by account code if any, then by account name. Or with \f[C]-S/--sort-amount\f[R], by their balance amount, largest first. -(Note: \f[C]-S\f[R] has a problem in hledger 1.11-1.18). .PP \[dq]Boring\[dq] accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more diff --git a/hledger/hledger.info b/hledger/hledger.info index 4c95b6fe7..321cfd867 100644 --- a/hledger/hledger.info +++ b/hledger/hledger.info @@ -955,38 +955,46 @@ $ hledger -f /some/file stats $ cat some.journal | hledger -f- - Usually the data file is in hledger's journal format, but it can also -be one of several other formats, listed below. hledger detects the -format automatically based on the file extension, or if that is not -recognised, by trying each built-in "reader" in turn: + Usually the data file is in hledger's journal format, but it can be +in any of the supported file formats, which currently are: -Reader: Reads: Used for file extensions: ---------------------------------------------------------------------------- -'journal'hledger's journal format, also '.journal' '.j' '.hledger' - some Ledger journals '.ledger' -'timeclock'timeclock files (precise time '.timeclock' - logging) -'timedot'timedot files (approximate '.timedot' - time logging) -'csv' comma-separated values (data '.csv' - interchange) +Reader: Reads: Used for file + extensions: +-------------------------------------------------------------------------- +'journal'hledger journal files and some Ledger '.journal' '.j' + journals, for transactions '.hledger' '.ledger' +'timeclock'timeclock files, for precise time '.timeclock' + logging +'timedot'timedot files, for approximate time '.timedot' + logging +'csv' comma/semicolon/tab/other-separated '.csv' '.ssv' '.tsv' + values, for data import - If needed (eg to ensure correct error messages when a file has the -"wrong" extension), you can force a specific reader/format by prepending -it to the file path with a colon. Examples: + hledger detects the format automatically based on the file extensions +shown above. If it can't recognise the file extension, it assumes +'journal' format. So for non-journal files, it's important to use a +recognised file extension, so as to either read successfully or to show +relevant error messages. + + When you can't ensure the right file extension, not to worry: you can +force a specific reader/format by prefixing the file path with the +format and a colon. Eg to read a .dat file as csv: $ hledger -f csv:/some/csv-file.dat stats $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- - You can also specify multiple '-f' options, to read multiple files as -one big journal. There are some limitations with this: + You can specify multiple '-f' options, to read multiple files as one +big journal. There are some limitations with this: * directives in one file will not affect the other files * balance assertions will not see any account balances from previous files - If you need those, either use the include directive, or concatenate -the files, eg: 'cat a.journal b.journal | hledger -f- CMD'. + If you need either of those things, you can + + * use a single parent file which includes the others + * or concatenate the files into one before reading, eg: 'cat + a.journal b.journal | hledger -f- CMD'.  File: hledger.info, Node: Output destination, Next: Output format, Prev: Input files, Up: OPTIONS @@ -2205,8 +2213,7 @@ $ hledger balance By default, accounts are displayed hierarchically, with subaccounts indented below their parent. At each level of the tree, accounts are sorted by account code if any, then by account name. Or with -'-S/--sort-amount', by their balance amount, largest first. (Note: '-S' -has a problem in hledger 1.11-1.18). +'-S/--sort-amount', by their balance amount, largest first. "Boring" accounts, which contain a single interesting subaccount and no balance of their own, are elided into the following line for more @@ -4095,164 +4102,164 @@ Node: Unicode characters28869 Ref: #unicode-characters29051 Node: Input files30463 Ref: #input-files30606 -Node: Output destination32535 -Ref: #output-destination32687 -Node: Output format33112 -Ref: #output-format33262 -Node: Regular expressions35429 -Ref: #regular-expressions35586 -Node: Smart dates37322 -Ref: #smart-dates37473 -Node: Report start & end date38834 -Ref: #report-start-end-date39006 -Node: Report intervals40503 -Ref: #report-intervals40668 -Node: Period expressions41058 -Ref: #period-expressions41218 -Node: Depth limiting45550 -Ref: #depth-limiting45694 -Node: Pivoting46026 -Ref: #pivoting46149 -Node: Valuation47825 -Ref: #valuation47927 -Node: -B Cost48616 -Ref: #b-cost48720 -Node: -V Value48853 -Ref: #v-value48999 -Node: -X Value in specified commodity49194 -Ref: #x-value-in-specified-commodity49393 -Node: Valuation date49542 -Ref: #valuation-date49710 -Node: Market prices50120 -Ref: #market-prices50300 -Node: --infer-value market prices from transactions51077 -Ref: #infer-value-market-prices-from-transactions51326 -Node: Valuation commodity52608 -Ref: #valuation-commodity52817 -Node: Simple valuation examples54043 -Ref: #simple-valuation-examples54245 -Node: --value Flexible valuation54904 -Ref: #value-flexible-valuation55112 -Node: More valuation examples57059 -Ref: #more-valuation-examples57268 -Node: Effect of valuation on reports59273 -Ref: #effect-of-valuation-on-reports59461 -Node: COMMANDS64982 -Ref: #commands65090 -Node: accounts66198 -Ref: #accounts66296 -Node: activity66995 -Ref: #activity67105 -Node: add67488 -Ref: #add67589 -Node: aregister70382 -Ref: #aregister70494 -Node: aregister and custom posting dates71867 -Ref: #aregister-and-custom-posting-dates72040 -Ref: #output-format-172633 -Node: balance73038 -Ref: #balance73155 -Node: Classic balance report74613 -Ref: #classic-balance-report74786 -Node: Customising the classic balance report76220 -Ref: #customising-the-classic-balance-report76448 -Node: Colour support78524 -Ref: #colour-support78691 -Node: Flat mode78787 -Ref: #flat-mode78935 -Node: Depth limited balance reports79348 -Ref: #depth-limited-balance-reports79533 -Node: Percentages79989 -Ref: #percentages80155 -Node: Multicolumn balance report81292 -Ref: #multicolumn-balance-report81472 -Node: Budget report87069 -Ref: #budget-report87212 -Node: Nested budgets92478 -Ref: #nested-budgets92590 -Ref: #output-format-296071 -Node: balancesheet96268 -Ref: #balancesheet96404 -Node: balancesheetequity97916 -Ref: #balancesheetequity98065 -Node: cashflow99141 -Ref: #cashflow99269 -Node: check-dates100485 -Ref: #check-dates100612 -Node: check-dupes100891 -Ref: #check-dupes101017 -Node: close101310 -Ref: #close101418 -Node: close usage102940 -Ref: #close-usage103033 -Node: codes105846 -Ref: #codes105954 -Node: commodities106666 -Ref: #commodities106793 -Node: descriptions106875 -Ref: #descriptions107003 -Node: diff107307 -Ref: #diff107413 -Node: files108460 -Ref: #files108560 -Node: help108707 -Ref: #help108807 -Node: import109888 -Ref: #import110002 -Node: Importing balance assignments110895 -Ref: #importing-balance-assignments111043 -Node: incomestatement111692 -Ref: #incomestatement111825 -Node: notes113170 -Ref: #notes113283 -Node: payees113651 -Ref: #payees113757 -Node: prices114177 -Ref: #prices114283 -Node: print114624 -Ref: #print114734 -Node: print-unique119530 -Ref: #print-unique119656 -Node: register119941 -Ref: #register120068 -Node: Custom register output124517 -Ref: #custom-register-output124646 -Node: register-match125983 -Ref: #register-match126117 -Node: rewrite126468 -Ref: #rewrite126583 -Node: Re-write rules in a file128438 -Ref: #re-write-rules-in-a-file128572 -Node: Diff output format129782 -Ref: #diff-output-format129951 -Node: rewrite vs print --auto131043 -Ref: #rewrite-vs.-print---auto131222 -Node: roi131778 -Ref: #roi131876 -Node: stats132888 -Ref: #stats132987 -Node: tags133775 -Ref: #tags133873 -Node: test134392 -Ref: #test134500 -Node: Add-on commands135247 -Ref: #add-on-commands135364 -Node: ui136707 -Ref: #ui136795 -Node: web136849 -Ref: #web136952 -Node: iadd137068 -Ref: #iadd137179 -Node: interest137261 -Ref: #interest137368 -Node: ENVIRONMENT137608 -Ref: #environment137720 -Node: FILES138705 -Ref: #files-1138808 -Node: LIMITATIONS139021 -Ref: #limitations139140 -Node: TROUBLESHOOTING139882 -Ref: #troubleshooting139995 +Node: Output destination32905 +Ref: #output-destination33057 +Node: Output format33482 +Ref: #output-format33632 +Node: Regular expressions35799 +Ref: #regular-expressions35956 +Node: Smart dates37692 +Ref: #smart-dates37843 +Node: Report start & end date39204 +Ref: #report-start-end-date39376 +Node: Report intervals40873 +Ref: #report-intervals41038 +Node: Period expressions41428 +Ref: #period-expressions41588 +Node: Depth limiting45920 +Ref: #depth-limiting46064 +Node: Pivoting46396 +Ref: #pivoting46519 +Node: Valuation48195 +Ref: #valuation48297 +Node: -B Cost48986 +Ref: #b-cost49090 +Node: -V Value49223 +Ref: #v-value49369 +Node: -X Value in specified commodity49564 +Ref: #x-value-in-specified-commodity49763 +Node: Valuation date49912 +Ref: #valuation-date50080 +Node: Market prices50490 +Ref: #market-prices50670 +Node: --infer-value market prices from transactions51447 +Ref: #infer-value-market-prices-from-transactions51696 +Node: Valuation commodity52978 +Ref: #valuation-commodity53187 +Node: Simple valuation examples54413 +Ref: #simple-valuation-examples54615 +Node: --value Flexible valuation55274 +Ref: #value-flexible-valuation55482 +Node: More valuation examples57429 +Ref: #more-valuation-examples57638 +Node: Effect of valuation on reports59643 +Ref: #effect-of-valuation-on-reports59831 +Node: COMMANDS65352 +Ref: #commands65460 +Node: accounts66568 +Ref: #accounts66666 +Node: activity67365 +Ref: #activity67475 +Node: add67858 +Ref: #add67959 +Node: aregister70752 +Ref: #aregister70864 +Node: aregister and custom posting dates72237 +Ref: #aregister-and-custom-posting-dates72410 +Ref: #output-format-173003 +Node: balance73408 +Ref: #balance73525 +Node: Classic balance report74983 +Ref: #classic-balance-report75156 +Node: Customising the classic balance report76540 +Ref: #customising-the-classic-balance-report76768 +Node: Colour support78844 +Ref: #colour-support79011 +Node: Flat mode79107 +Ref: #flat-mode79255 +Node: Depth limited balance reports79668 +Ref: #depth-limited-balance-reports79853 +Node: Percentages80309 +Ref: #percentages80475 +Node: Multicolumn balance report81612 +Ref: #multicolumn-balance-report81792 +Node: Budget report87389 +Ref: #budget-report87532 +Node: Nested budgets92798 +Ref: #nested-budgets92910 +Ref: #output-format-296391 +Node: balancesheet96588 +Ref: #balancesheet96724 +Node: balancesheetequity98236 +Ref: #balancesheetequity98385 +Node: cashflow99461 +Ref: #cashflow99589 +Node: check-dates100805 +Ref: #check-dates100932 +Node: check-dupes101211 +Ref: #check-dupes101337 +Node: close101630 +Ref: #close101738 +Node: close usage103260 +Ref: #close-usage103353 +Node: codes106166 +Ref: #codes106274 +Node: commodities106986 +Ref: #commodities107113 +Node: descriptions107195 +Ref: #descriptions107323 +Node: diff107627 +Ref: #diff107733 +Node: files108780 +Ref: #files108880 +Node: help109027 +Ref: #help109127 +Node: import110208 +Ref: #import110322 +Node: Importing balance assignments111215 +Ref: #importing-balance-assignments111363 +Node: incomestatement112012 +Ref: #incomestatement112145 +Node: notes113490 +Ref: #notes113603 +Node: payees113971 +Ref: #payees114077 +Node: prices114497 +Ref: #prices114603 +Node: print114944 +Ref: #print115054 +Node: print-unique119850 +Ref: #print-unique119976 +Node: register120261 +Ref: #register120388 +Node: Custom register output124837 +Ref: #custom-register-output124966 +Node: register-match126303 +Ref: #register-match126437 +Node: rewrite126788 +Ref: #rewrite126903 +Node: Re-write rules in a file128758 +Ref: #re-write-rules-in-a-file128892 +Node: Diff output format130102 +Ref: #diff-output-format130271 +Node: rewrite vs print --auto131363 +Ref: #rewrite-vs.-print---auto131542 +Node: roi132098 +Ref: #roi132196 +Node: stats133208 +Ref: #stats133307 +Node: tags134095 +Ref: #tags134193 +Node: test134712 +Ref: #test134820 +Node: Add-on commands135567 +Ref: #add-on-commands135684 +Node: ui137027 +Ref: #ui137115 +Node: web137169 +Ref: #web137272 +Node: iadd137388 +Ref: #iadd137499 +Node: interest137581 +Ref: #interest137688 +Node: ENVIRONMENT137928 +Ref: #environment138040 +Node: FILES139025 +Ref: #files-1139128 +Node: LIMITATIONS139341 +Ref: #limitations139460 +Node: TROUBLESHOOTING140202 +Ref: #troubleshooting140315  End Tag Table diff --git a/hledger/hledger.txt b/hledger/hledger.txt index 8771a3c2e..7132ea02a 100644 --- a/hledger/hledger.txt +++ b/hledger/hledger.txt @@ -810,39 +810,48 @@ OPTIONS $ cat some.journal | hledger -f- - Usually the data file is in hledger's journal format, but it can also - be one of several other formats, listed below. hledger detects the - format automatically based on the file extension, or if that is not - recognised, by trying each built-in "reader" in turn: + Usually the data file is in hledger's journal format, but it can be in + any of the supported file formats, which currently are: - Reader: Reads: Used for file extensions: + Reader: Reads: Used for file exten- + sions: ----------------------------------------------------------------------------- - journal hledger's journal format, also .journal .j .hledger .ledger - some Ledger journals - time- timeclock files (precise time .timeclock - clock logging) - timedot timedot files (approximate time .timedot - logging) - csv comma-separated values (data .csv - interchange) + journal hledger journal files and some Ledger .journal .j .hledger + journals, for transactions .ledger + time- timeclock files, for precise time log- .timeclock + clock ging + timedot timedot files, for approximate time .timedot + logging + csv comma/semicolon/tab/other-separated .csv .ssv .tsv + values, for data import - If needed (eg to ensure correct error messages when a file has the - "wrong" extension), you can force a specific reader/format by prepend- - ing it to the file path with a colon. Examples: + hledger detects the format automatically based on the file extensions + shown above. If it can't recognise the file extension, it assumes + journal format. So for non-journal files, it's important to use a + recognised file extension, so as to either read successfully or to show + relevant error messages. + + When you can't ensure the right file extension, not to worry: you can + force a specific reader/format by prefixing the file path with the for- + mat and a colon. Eg to read a .dat file as csv: $ hledger -f csv:/some/csv-file.dat stats $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- - You can also specify multiple -f options, to read multiple files as one - big journal. There are some limitations with this: + You can specify multiple -f options, to read multiple files as one big + journal. There are some limitations with this: o directives in one file will not affect the other files o balance assertions will not see any account balances from previous files - If you need those, either use the include directive, or concatenate the - files, eg: cat a.journal b.journal | hledger -f- CMD. + If you need either of those things, you can + + o use a single parent file which includes the others + + o or concatenate the files into one before reading, eg: cat a.journal + b.journal | hledger -f- CMD. Output destination hledger commands send their output to the terminal by default. You can @@ -1062,6 +1071,7 @@ OPTIONS 1, 2009 -p "from 2009/1" the same -p "from 2009" the same + -p "to 2009" everything before january 1, 2009 @@ -1070,8 +1080,6 @@ OPTIONS -p "2009" the year 2009; equivalent to "2009/1/1 to 2010/1/1" - - -p "2009/1" the month of jan; equiva- lent to "2009/1/1 to 2009/2/1" @@ -1139,8 +1147,6 @@ OPTIONS -p "every 2nd day of periods will go from Tue to Tue week" -p "every Tue" same - - -p "every 15th day" period boundaries will be on 15th of each month -p "every 2nd Monday" period boundaries will be on second Monday of @@ -1552,13 +1558,11 @@ OPTIONS amounts terval, val- (with report ued at inter- interval) val start - - - running to- sum/average sum/average sum/average sum/average sum/average tal/average of displayed of displayed of displayed of displayed of displayed values values values values values + balance (bs, bse, cf, is..) @@ -1865,21 +1869,20 @@ COMMANDS By default, accounts are displayed hierarchically, with subaccounts in- dented below their parent. At each level of the tree, accounts are sorted by account code if any, then by account name. Or with - -S/--sort-amount, by their balance amount, largest first. (Note: -S - has a problem in hledger 1.11-1.18). + -S/--sort-amount, by their balance amount, largest first. "Boring" accounts, which contain a single interesting subaccount and no - balance of their own, are elided into the following line for more com- - pact output. (Eg above, the "liabilities" account.) Use --no-elide to + balance of their own, are elided into the following line for more com- + pact output. (Eg above, the "liabilities" account.) Use --no-elide to prevent this. - Account balances are "inclusive" - they include the balances of any + Account balances are "inclusive" - they include the balances of any subaccounts. - Accounts which have zero balance (and no non-zero subaccounts) are + Accounts which have zero balance (and no non-zero subaccounts) are omitted. Use -E/--empty to show them. - A final total is displayed by default; use -N/--no-total to suppress + A final total is displayed by default; use -N/--no-total to suppress it, eg: $ hledger balance -p 2008/6 expenses --no-total @@ -1888,7 +1891,7 @@ COMMANDS $1 supplies Customising the classic balance report - You can customise the layout of classic balance reports with --format + You can customise the layout of classic balance reports with --format FMT: $ hledger balance --format "%20(account) %12(total)" @@ -1906,7 +1909,7 @@ COMMANDS 0 The FMT format string (plus a newline) specifies the formatting applied - to each account/balance pair. It may contain any suitable text, with + to each account/balance pair. It may contain any suitable text, with data fields interpolated like so: %[MIN][.MAX](FIELDNAME) @@ -1917,14 +1920,14 @@ COMMANDS o FIELDNAME must be enclosed in parentheses, and can be one of: - o depth_spacer - a number of spaces equal to the account's depth, or + o depth_spacer - a number of spaces equal to the account's depth, or if MIN is specified, MIN * depth spaces. o account - the account's name o total - the account's balance/posted total, right justified - Also, FMT can begin with an optional prefix to control how multi-com- + Also, FMT can begin with an optional prefix to control how multi-com- modity amounts are rendered: o %_ - render on multiple lines, bottom-aligned (the default) @@ -1941,24 +1944,24 @@ COMMANDS o %(total) - the account's total - o %-20.20(account) - the account's name, left justified, padded to 20 + o %-20.20(account) - the account's name, left justified, padded to 20 characters and clipped at 20 characters - o %,%-50(account) %25(total) - account name padded to 50 characters, - total padded to 20 characters, with multiple commodities rendered on + o %,%-50(account) %25(total) - account name padded to 50 characters, + total padded to 20 characters, with multiple commodities rendered on one line - o %20(total) %2(depth_spacer)%-(account) - the default format for the + o %20(total) %2(depth_spacer)%-(account) - the default format for the single-column balance report Colour support - In terminal output, when colour is enabled, the balance command shows + In terminal output, when colour is enabled, the balance command shows negative amounts in red. Flat mode - To see a flat list instead of the default hierarchical display, use - --flat. In this mode, accounts (unless depth-clipped) show their full - names and "exclusive" balance, excluding any subaccount balances. In + To see a flat list instead of the default hierarchical display, use + --flat. In this mode, accounts (unless depth-clipped) show their full + names and "exclusive" balance, excluding any subaccount balances. In this mode, you can also use --drop N to omit the first few account name components. @@ -1967,8 +1970,8 @@ COMMANDS $1 supplies Depth limited balance reports - With --depth N or depth:N or just -N, balance reports show accounts - only to the specified numeric depth. This is very useful to summarise + With --depth N or depth:N or just -N, balance reports show accounts + only to the specified numeric depth. This is very useful to summarise a complex set of accounts and get an overview. $ hledger balance -N -1 @@ -1981,9 +1984,9 @@ COMMANDS inclusive balances at the depth limit. Percentages - With -% or --percent, balance reports show each account's value ex- - pressed as a percentage of the column's total. This is useful to get - an overview of the relative sizes of account balances. For example to + With -% or --percent, balance reports show each account's value ex- + pressed as a percentage of the column's total. This is useful to get + an overview of the relative sizes of account balances. For example to obtain an overview of expenses: $ hledger balance expenses -% @@ -1993,32 +1996,32 @@ COMMANDS -------------------- 100.0 % - Note that --tree does not have an effect on -%. The percentages are - always relative to the total sum of each column, they are never rela- + Note that --tree does not have an effect on -%. The percentages are + always relative to the total sum of each column, they are never rela- tive to the parent account. - Since the percentages are relative to the columns sum, it is usually - not useful to calculate percentages if the signs of the amounts are - mixed. Although the results are technically correct, they are most - likely useless. Especially in a balance report that sums up to zero + Since the percentages are relative to the columns sum, it is usually + not useful to calculate percentages if the signs of the amounts are + mixed. Although the results are technically correct, they are most + likely useless. Especially in a balance report that sums up to zero (eg hledger balance -B) all percentage values will be zero. - This flag does not work if the report contains any mixed commodity ac- + This flag does not work if the report contains any mixed commodity ac- counts. If there are mixed commodity accounts in the report be sure to use -V or -B to coerce the report into using a single commodity. Multicolumn balance report - Multicolumn or tabular balance reports are a very useful hledger fea- - ture, and usually the preferred style. They share many of the above - features, but they show the report as a table, with columns represent- - ing time periods. This mode is activated by providing a reporting in- + Multicolumn or tabular balance reports are a very useful hledger fea- + ture, and usually the preferred style. They share many of the above + features, but they show the report as a table, with columns represent- + ing time periods. This mode is activated by providing a reporting in- terval. - There are three types of multicolumn balance report, showing different + There are three types of multicolumn balance report, showing different information: 1. By default: each column shows the sum of postings in that period, ie - the account's change of balance in that period. This is useful eg + the account's change of balance in that period. This is useful eg for a monthly income statement: $ hledger balance --quarterly income expenses -E @@ -2034,7 +2037,7 @@ COMMANDS || $-1 $1 0 0 2. With --cumulative: each column shows the ending balance for that pe- - riod, accumulating the changes across periods, starting from 0 at + riod, accumulating the changes across periods, starting from 0 at the report start date: $ hledger balance --quarterly income expenses -E --cumulative @@ -2050,8 +2053,8 @@ COMMANDS || $-1 0 0 0 3. With --historical/-H: each column shows the actual historical ending - balance for that period, accumulating the changes across periods, - starting from the actual balance at the report start date. This is + balance for that period, accumulating the changes across periods, + starting from the actual balance at the report start date. This is useful eg for a multi-period balance sheet, and when you are showing only the data after a certain start date: @@ -2070,26 +2073,26 @@ COMMANDS Note that --cumulative or --historical/-H disable --row-total/-T, since summing end balances generally does not make sense. - Multicolumn balance reports display accounts in flat mode by default; + Multicolumn balance reports display accounts in flat mode by default; to see the hierarchy, use --tree. - With a reporting interval (like --quarterly above), the report - start/end dates will be adjusted if necessary so that they encompass + With a reporting interval (like --quarterly above), the report + start/end dates will be adjusted if necessary so that they encompass the displayed report periods. This is so that the first and last peri- ods will be "full" and comparable to the others. - The -E/--empty flag does two things in multicolumn balance reports: + The -E/--empty flag does two things in multicolumn balance reports: first, the report will show all columns within the specified report pe- - riod (without -E, leading and trailing columns with all zeroes are not - shown). Second, all accounts which existed at the report start date - will be considered, not just the ones with activity during the report - period (use -E to include low-activity accounts which would otherwise + riod (without -E, leading and trailing columns with all zeroes are not + shown). Second, all accounts which existed at the report start date + will be considered, not just the ones with activity during the report + period (use -E to include low-activity accounts which would otherwise would be omitted). The -T/--row-total flag adds an additional column showing the total for each row. - The -A/--average flag adds a column showing the average value in each + The -A/--average flag adds a column showing the average value in each row. Here's an example of all three: @@ -2110,27 +2113,27 @@ COMMANDS (Average is rounded to the dollar here since all journal amounts are) - The --transpose flag can be used to exchange the rows and columns of a + The --transpose flag can be used to exchange the rows and columns of a multicolumn report. - When showing multicommodity amounts, multicolumn balance reports will + When showing multicommodity amounts, multicolumn balance reports will elide any amounts which have more than two commodities, since otherwise - columns could get very wide. The --no-elide flag disables this. Hid- - ing totals with the -N/--no-total flag can also help reduce the width + columns could get very wide. The --no-elide flag disables this. Hid- + ing totals with the -N/--no-total flag can also help reduce the width of multicommodity reports. When the report is still too wide, a good workaround is to pipe it into - less -RS (-R for colour, -S to chop long lines). Eg: hledger bal -D + less -RS (-R for colour, -S to chop long lines). Eg: hledger bal -D --color=yes | less -RS. Budget report - With --budget, extra columns are displayed showing budget goals for - each account and period, if any. Budget goals are defined by periodic + With --budget, extra columns are displayed showing budget goals for + each account and period, if any. Budget goals are defined by periodic transactions. This is very useful for comparing planned and actual in- - come, expenses, time usage, etc. --budget is most often combined with + come, expenses, time usage, etc. --budget is most often combined with a report interval. - For example, you can take average monthly expenses in the common ex- + For example, you can take average monthly expenses in the common ex- pense categories to construct a minimal monthly budget: ;; Budget @@ -2177,26 +2180,26 @@ COMMANDS This is different from a normal balance report in several ways: - o Only accounts with budget goals during the report period are shown, + o Only accounts with budget goals during the report period are shown, by default. - o In each column, in square brackets after the actual amount, budget - goal amounts are shown, and the actual/goal percentage. (Note: bud- + o In each column, in square brackets after the actual amount, budget + goal amounts are shown, and the actual/goal percentage. (Note: bud- get goals should be in the same commodity as the actual amount.) - o All parent accounts are always shown, even in flat mode. Eg assets, + o All parent accounts are always shown, even in flat mode. Eg assets, assets:bank, and expenses above. - o Amounts always include all subaccounts, budgeted or unbudgeted, even + o Amounts always include all subaccounts, budgeted or unbudgeted, even in flat mode. This means that the numbers displayed will not always add up! Eg above, - the expenses actual amount includes the gifts and supplies transac- - tions, but the expenses:gifts and expenses:supplies accounts are not + the expenses actual amount includes the gifts and supplies transac- + tions, but the expenses:gifts and expenses:supplies accounts are not shown, as they have no budget amounts declared. - This can be confusing. When you need to make things clearer, use the - -E/--empty flag, which will reveal all accounts including unbudgeted + This can be confusing. When you need to make things clearer, use the + -E/--empty flag, which will reveal all accounts including unbudgeted ones, giving the full picture. Eg: $ hledger balance -M --budget --empty @@ -2238,12 +2241,12 @@ COMMANDS For more examples, see Budgeting and Forecasting. Nested budgets - You can add budgets to any account in your account hierarchy. If you + You can add budgets to any account in your account hierarchy. If you have budgets on both parent account and some of its children, then bud- - get(s) of the child account(s) would be added to the budget of their + get(s) of the child account(s) would be added to the budget of their parent, much like account balances behave. - In the most simple case this means that once you add a budget to any + In the most simple case this means that once you add a budget to any account, all its parents would have budget as well. To illustrate this, consider the following budget: @@ -2253,13 +2256,13 @@ COMMANDS expenses:personal:electronics $100.00 liabilities - With this, monthly budget for electronics is defined to be $100 and - budget for personal expenses is an additional $1000, which implicitly + With this, monthly budget for electronics is defined to be $100 and + budget for personal expenses is an additional $1000, which implicitly means that budget for both expenses:personal and expenses is $1100. - Transactions in expenses:personal:electronics will be counted both to- + Transactions in expenses:personal:electronics will be counted both to- wards its $100 budget and $1100 of expenses:personal , and transactions - in any other subaccount of expenses:personal would be counted towards + in any other subaccount of expenses:personal would be counted towards only towards the budget of expenses:personal. For example, let's consider these transactions: @@ -2285,9 +2288,9 @@ COMMANDS expenses:personal $30.00 liabilities - As you can see, we have transactions in expenses:personal:electron- - ics:upgrades and expenses:personal:train tickets, and since both of - these accounts are without explicitly defined budget, these transac- + As you can see, we have transactions in expenses:personal:electron- + ics:upgrades and expenses:personal:train tickets, and since both of + these accounts are without explicitly defined budget, these transac- tions would be counted towards budgets of expenses:personal:electronics and expenses:personal accordingly: @@ -2303,7 +2306,7 @@ COMMANDS -------------------------------++------------------------------- || 0 [ 0] - And with --empty, we can get a better picture of budget allocation and + And with --empty, we can get a better picture of budget allocation and consumption: $ hledger balance --budget -M --empty @@ -2322,19 +2325,19 @@ COMMANDS Output format This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, (multicolumn non-bud- + tions The output formats supported are txt, csv, (multicolumn non-bud- get reports only) html, and (experimental) json. balancesheet balancesheet, bs - This command displays a balance sheet, showing historical ending bal- + This command displays a balance sheet, showing historical ending bal- ances of asset and liability accounts. (To see equity as well, use the - balancesheetequity command.) Amounts are shown with normal positive + balancesheetequity command.) Amounts are shown with normal positive sign, as in conventional financial statements. The asset and liability accounts shown are those accounts declared with - the Asset or Cash or Liability type, or otherwise all accounts under a - top-level asset or liability account (case insensitive, plurals al- + the Asset or Cash or Liability type, or otherwise all accounts under a + top-level asset or liability account (case insensitive, plurals al- lowed). Example: @@ -2359,25 +2362,25 @@ COMMANDS 0 With a reporting interval, multiple columns will be shown, one for each - report period. As with multicolumn balance reports, you can alter the - report mode with --change/--cumulative/--historical. Normally bal- - ancesheet shows historical ending balances, which is what you need for - a balance sheet; note this means it ignores report begin dates (and - -T/--row-total, since summing end balances generally does not make - sense). Instead of absolute values percentages can be displayed with + report period. As with multicolumn balance reports, you can alter the + report mode with --change/--cumulative/--historical. Normally bal- + ancesheet shows historical ending balances, which is what you need for + a balance sheet; note this means it ignores report begin dates (and + -T/--row-total, since summing end balances generally does not make + sense). Instead of absolute values percentages can be displayed with -%. This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. balancesheetequity balancesheetequity, bse - This command displays a balance sheet, showing historical ending bal- - ances of asset, liability and equity accounts. Amounts are shown with + This command displays a balance sheet, showing historical ending bal- + ances of asset, liability and equity accounts. Amounts are shown with normal positive sign, as in conventional financial statements. - The asset, liability and equity accounts shown are those accounts de- + The asset, liability and equity accounts shown are those accounts de- clared with the Asset, Cash, Liability or Equity type, or otherwise all accounts under a top-level asset, liability or equity account (case in- sensitive, plurals allowed). @@ -2409,18 +2412,18 @@ COMMANDS 0 This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. cashflow cashflow, cf - This command displays a cashflow statement, showing the inflows and - outflows affecting "cash" (ie, liquid) assets. Amounts are shown with + This command displays a cashflow statement, showing the inflows and + outflows affecting "cash" (ie, liquid) assets. Amounts are shown with normal positive sign, as in conventional financial statements. - The "cash" accounts shown are those accounts declared with the Cash - type, or otherwise all accounts under a top-level asset account (case - insensitive, plural allowed) which do not have fixed, investment, re- + The "cash" accounts shown are those accounts declared with the Cash + type, or otherwise all accounts under a top-level asset account (case + insensitive, plural allowed) which do not have fixed, investment, re- ceivable or A/R in their name. Example: @@ -2440,90 +2443,90 @@ COMMANDS $-1 With a reporting interval, multiple columns will be shown, one for each - report period. Normally cashflow shows changes in assets per period, - though as with multicolumn balance reports you can alter the report + report period. Normally cashflow shows changes in assets per period, + though as with multicolumn balance reports you can alter the report mode with --change/--cumulative/--historical. Instead of absolute val- ues percentages can be displayed with -%. This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. check-dates check-dates - Check that transactions are sorted by increasing date. With --date2, - checks secondary dates instead. With --strict, dates must also be - unique. With a query, only matched transactions' dates are checked. + Check that transactions are sorted by increasing date. With --date2, + checks secondary dates instead. With --strict, dates must also be + unique. With a query, only matched transactions' dates are checked. Reads the default journal file, or another specified with -f. check-dupes check-dupes - Reports account names having the same leaf but different prefixes. In - other words, two or more leaves that are categorized differently. + Reports account names having the same leaf but different prefixes. In + other words, two or more leaves that are categorized differently. Reads the default journal file, or another specified as an argument. An example: http://stefanorodighiero.net/software/hledger-dupes.html close close, equity - Prints a "closing balances" transaction and an "opening balances" + Prints a "closing balances" transaction and an "opening balances" transaction that bring account balances to and from zero, respectively. These can be added to your journal file(s), eg to bring asset/liability - balances forward into a new journal file, or to close out revenues/ex- + balances forward into a new journal file, or to close out revenues/ex- penses to retained earnings at the end of a period. - You can print just one of these transactions by using the --close or - --open flag. You can customise their descriptions with the --close- + You can print just one of these transactions by using the --close or + --open flag. You can customise their descriptions with the --close- desc and --open-desc options. One amountless posting to "equity:opening/closing balances" is added to - balance the transactions, by default. You can customise this account - name with --close-acct and --open-acct; if you specify only one of + balance the transactions, by default. You can customise this account + name with --close-acct and --open-acct; if you specify only one of these, it will be used for both. With --x/--explicit, the equity posting's amount will be shown. And if - it involves multiple commodities, a posting for each commodity will be + it involves multiple commodities, a posting for each commodity will be shown, as with the print command. - With --interleaved, the equity postings are shown next to the postings + With --interleaved, the equity postings are shown next to the postings they balance, which makes troubleshooting easier. By default, transaction prices in the journal are ignored when generat- ing the closing/opening transactions. With --show-costs, this cost in- - formation is preserved (balance -B reports will be unchanged after the - transition). Separate postings are generated for each cost in each - commodity. Note this can generate very large journal entries, if you + formation is preserved (balance -B reports will be unchanged after the + transition). Separate postings are generated for each cost in each + commodity. Note this can generate very large journal entries, if you have many foreign currency or investment transactions. close usage If you split your journal files by time (eg yearly), you will typically - run this command at the end of the year, and save the closing transac- - tion as last entry of the old file, and the opening transaction as the - first entry of the new file. This makes the files self contained, so - that correct balances are reported no matter which of them are loaded. - Ie, if you load just one file, the balances are initialised correctly; - or if you load several files, the redundant closing/opening transac- - tions cancel each other out. (They will show up in print or register - reports; you can exclude them with a query like not:desc:'(open- + run this command at the end of the year, and save the closing transac- + tion as last entry of the old file, and the opening transaction as the + first entry of the new file. This makes the files self contained, so + that correct balances are reported no matter which of them are loaded. + Ie, if you load just one file, the balances are initialised correctly; + or if you load several files, the redundant closing/opening transac- + tions cancel each other out. (They will show up in print or register + reports; you can exclude them with a query like not:desc:'(open- ing|closing) balances'.) If you're running a business, you might also use this command to "close - the books" at the end of an accounting period, transferring income - statement account balances to retained earnings. (You may want to + the books" at the end of an accounting period, transferring income + statement account balances to retained earnings. (You may want to change the equity account name to something like "equity:retained earn- ings".) - By default, the closing transaction is dated yesterday, the balances - are calculated as of end of yesterday, and the opening transaction is - dated today. To close on some other date, use: hledger close -e OPEN- - INGDATE. Eg, to close/open on the 2018/2019 boundary, use -e 2019. + By default, the closing transaction is dated yesterday, the balances + are calculated as of end of yesterday, and the opening transaction is + dated today. To close on some other date, use: hledger close -e OPEN- + INGDATE. Eg, to close/open on the 2018/2019 boundary, use -e 2019. You can also use -p or date:PERIOD (any starting date is ignored). - Both transactions will include balance assertions for the closed/re- + Both transactions will include balance assertions for the closed/re- opened accounts. You probably shouldn't use status or realness filters - (like -C or -R or status:) with this command, or the generated balance - assertions will depend on these flags. Likewise, if you run this com- - mand with --auto, the balance assertions will probably always require + (like -C or -R or status:) with this command, or the generated balance + assertions will depend on these flags. Likewise, if you run this com- + mand with --auto, the balance assertions will probably always require --auto. Examples: @@ -2564,13 +2567,13 @@ COMMANDS codes List the codes seen in transactions, in the order parsed. - This command prints the value of each transaction's code field, in the - order transactions were parsed. The transaction code is an optional - value written in parentheses between the date and description, often + This command prints the value of each transaction's code field, in the + order transactions were parsed. The transaction code is an optional + value written in parentheses between the date and description, often used to store a cheque number, order number or similar. Transactions aren't required to have a code, and missing or empty codes - will not be shown by default. With the -E/--empty flag, they will be + will not be shown by default. With the -E/--empty flag, they will be printed as blank lines. You can add a query to select a subset of transactions. @@ -2610,7 +2613,7 @@ COMMANDS List the unique descriptions that appear in transactions. This command lists the unique descriptions that appear in transactions, - in alphabetic order. You can add a query to select a subset of trans- + in alphabetic order. You can add a query to select a subset of trans- actions. Example: @@ -2622,18 +2625,18 @@ COMMANDS diff diff - Compares a particular account's transactions in two input files. It + Compares a particular account's transactions in two input files. It shows any transactions to this account which are in one file but not in the other. More precisely, for each posting affecting this account in either file, - it looks for a corresponding posting in the other file which posts the - same amount to the same account (ignoring date, description, etc.) + it looks for a corresponding posting in the other file which posts the + same amount to the same account (ignoring date, description, etc.) Since postings not transactions are compared, this also works when mul- tiple bank transactions have been combined into a single journal entry. This is useful eg if you have downloaded an account's transactions from - your bank (eg as CSV data). When hledger and your bank disagree about + your bank (eg as CSV data). When hledger and your bank disagree about the account balance, you can compare the bank data with your journal to find out the cause. @@ -2651,20 +2654,20 @@ COMMANDS files files - List all files included in the journal. With a REGEX argument, only + List all files included in the journal. With a REGEX argument, only file names matching the regular expression (case sensitive) are shown. help help Show any of the hledger manuals. - The help command displays any of the main hledger manuals, in one of - several ways. Run it with no argument to list the manuals, or provide + The help command displays any of the main hledger manuals, in one of + several ways. Run it with no argument to list the manuals, or provide a full or partial manual name to select one. - hledger manuals are available in several formats. hledger help will - use the first of these display methods that it finds: info, man, - $PAGER, less, stdout (or when non-interactive, just stdout). You can + hledger manuals are available in several formats. hledger help will + use the first of these display methods that it finds: info, man, + $PAGER, less, stdout (or when non-interactive, just stdout). You can force a particular viewer with the --info, --man, --pager, --cat flags. Examples: @@ -2691,9 +2694,9 @@ COMMANDS import import - Read new transactions added to each FILE since last run, and add them - to the main journal file. Or with --dry-run, just print the transac- - tions that would be added. Or with --catchup, just mark all of the + Read new transactions added to each FILE since last run, and add them + to the main journal file. Or with --dry-run, just print the transac- + tions that would be added. Or with --catchup, just mark all of the FILEs' transactions as imported, without actually importing any. The input files are specified as arguments - no need to write -f before @@ -2704,34 +2707,34 @@ COMMANDS ing transactions are always added to the input files in increasing date order, and by saving .latest.FILE state files. - The --dry-run output is in journal format, so you can filter it, eg to + The --dry-run output is in journal format, so you can filter it, eg to see only uncategorised transactions: $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions Importing balance assignments - Entries added by import will have their posting amounts made explicit - (like hledger print -x). This means that any balance assignments in - imported files must be evaluated; but, imported files don't get to see - the main file's account balances. As a result, importing entries with + Entries added by import will have their posting amounts made explicit + (like hledger print -x). This means that any balance assignments in + imported files must be evaluated; but, imported files don't get to see + the main file's account balances. As a result, importing entries with balance assignments (eg from an institution that provides only balances - and not posting amounts) will probably generate incorrect posting + and not posting amounts) will probably generate incorrect posting amounts. To avoid this problem, use print instead of import: $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE - (If you think import should leave amounts implicit like print does, + (If you think import should leave amounts implicit like print does, please test it and send a pull request.) incomestatement incomestatement, is - This command displays an income statement, showing revenues and ex- + This command displays an income statement, showing revenues and ex- penses during one or more periods. Amounts are shown with normal posi- tive sign, as in conventional financial statements. The revenue and expense accounts shown are those accounts declared with - the Revenue or Expense type, or otherwise all accounts under a top- - level revenue or income or expense account (case insensitive, plurals + the Revenue or Expense type, or otherwise all accounts under a top- + level revenue or income or expense account (case insensitive, plurals allowed). Example: @@ -2758,13 +2761,13 @@ COMMANDS 0 With a reporting interval, multiple columns will be shown, one for each - report period. Normally incomestatement shows revenues/expenses per - period, though as with multicolumn balance reports you can alter the - report mode with --change/--cumulative/--historical. Instead of abso- + report period. Normally incomestatement shows revenues/expenses per + period, though as with multicolumn balance reports you can alter the + report mode with --change/--cumulative/--historical. Instead of abso- lute values percentages can be displayed with -%. This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. notes @@ -2772,8 +2775,8 @@ COMMANDS List the unique notes that appear in transactions. This command lists the unique notes that appear in transactions, in al- - phabetic order. You can add a query to select a subset of transac- - tions. The note is the part of the transaction description after a | + phabetic order. You can add a query to select a subset of transac- + tions. The note is the part of the transaction description after a | character (or if there is no |, the whole description). Example: @@ -2787,8 +2790,8 @@ COMMANDS List the unique payee/payer names that appear in transactions. This command lists the unique payee/payer names that appear in transac- - tions, in alphabetic order. You can add a query to select a subset of - transactions. The payee/payer is the part of the transaction descrip- + tions, in alphabetic order. You can add a query to select a subset of + transactions. The payee/payer is the part of the transaction descrip- tion before a | character (or if there is no |, the whole description). Example: @@ -2800,10 +2803,10 @@ COMMANDS prices prices - Print market price directives from the journal. With --costs, also - print synthetic market prices based on transaction prices. With --in- - verted-costs, also print inverse prices based on transaction prices. - Prices (and postings providing prices) can be filtered by a query. + Print market price directives from the journal. With --costs, also + print synthetic market prices based on transaction prices. With --in- + verted-costs, also print inverse prices based on transaction prices. + Prices (and postings providing prices) can be filtered by a query. Price amounts are always displayed with their full precision. print @@ -2811,11 +2814,11 @@ COMMANDS Show transaction journal entries, sorted by date. The print command displays full journal entries (transactions) from the - journal file in date order, tidily formatted. With --date2, transac- + journal file in date order, tidily formatted. With --date2, transac- tions are sorted by secondary date instead. print's output is always a valid hledger journal. - It preserves all transaction information, but it does not preserve di- + It preserves all transaction information, but it does not preserve di- rectives or inter-transaction comments $ hledger print @@ -2842,43 +2845,43 @@ COMMANDS Normally, the journal entry's explicit or implicit amount style is pre- served. For example, when an amount is omitted in the journal, it will - not appear in the output. Similarly, when a transaction price is im- - plied but not written, it will not appear in the output. You can use - the -x/--explicit flag to make all amounts and transaction prices ex- - plicit, which can be useful for troubleshooting or for making your + not appear in the output. Similarly, when a transaction price is im- + plied but not written, it will not appear in the output. You can use + the -x/--explicit flag to make all amounts and transaction prices ex- + plicit, which can be useful for troubleshooting or for making your journal more readable and robust against data entry errors. -x is also implied by using any of -B,-V,-X,--value. - Note, -x/--explicit will cause postings with a multi-commodity amount - (these can arise when a multi-commodity transaction has an implicit - amount) to be split into multiple single-commodity postings, keeping + Note, -x/--explicit will cause postings with a multi-commodity amount + (these can arise when a multi-commodity transaction has an implicit + amount) to be split into multiple single-commodity postings, keeping the output parseable. - With -B/--cost, amounts with transaction prices are converted to cost + With -B/--cost, amounts with transaction prices are converted to cost using that price. This can be used for troubleshooting. - With -m/--match and a STR argument, print will show at most one trans- - action: the one one whose description is most similar to STR, and is - most recent. STR should contain at least two characters. If there is + With -m/--match and a STR argument, print will show at most one trans- + action: the one one whose description is most similar to STR, and is + most recent. STR should contain at least two characters. If there is no similar-enough match, no transaction will be shown. With --new, for each FILE being read, hledger reads (and writes) a spe- - cial state file (.latest.FILE in the same directory), containing the - latest transaction date(s) that were seen last time FILE was read. - When this file is found, only transactions with newer dates (and new - transactions on the latest date) are printed. This is useful for ig- - noring already-seen entries in import data, such as downloaded CSV + cial state file (.latest.FILE in the same directory), containing the + latest transaction date(s) that were seen last time FILE was read. + When this file is found, only transactions with newer dates (and new + transactions on the latest date) are printed. This is useful for ig- + noring already-seen entries in import data, such as downloaded CSV files. Eg: $ hledger -f bank1.csv print --new (shows transactions added since last print --new on this file) - This assumes that transactions added to FILE always have same or in- - creasing dates, and that transactions on the same day do not get re- + This assumes that transactions added to FILE always have same or in- + creasing dates, and that transactions on the same day do not get re- ordered. See also the import command. This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, and (experimental) + tions The output formats supported are txt, csv, and (experimental) json and sql. Here's an example of print's CSV output: @@ -2897,20 +2900,20 @@ COMMANDS "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 + 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 + 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" + 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 + 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.) print-unique @@ -2934,14 +2937,14 @@ COMMANDS Show postings and their running total. The register command displays matched postings, across all accounts, in - date order, with their running total or running historical balance. - (See also the aregister command, which shows matched transactions in a + date order, with their running total or running historical balance. + (See also the aregister command, which shows matched transactions in a specific account.) register normally shows line per posting, but note that multi-commodity amounts will occupy multiple lines (one line per commodity). - It is typically used with a query selecting a particular account, to + It is typically used with a query selecting a particular account, to see that account's activity: $ hledger register checking @@ -2952,8 +2955,8 @@ COMMANDS With --date2, it shows and sorts by secondary date instead. - The --historical/-H flag adds the balance from any undisplayed prior - postings to the running total. This is useful when you want to see + The --historical/-H flag adds the balance from any undisplayed prior + postings to the running total. This is useful when you want to see only recent activity, with a historically accurate running balance: $ hledger register checking -b 2008/6 --historical @@ -2963,18 +2966,18 @@ COMMANDS The --depth option limits the amount of sub-account detail displayed. - The --average/-A flag shows the running average posting amount instead + The --average/-A flag shows the running average posting amount instead of the running total (so, the final number displayed is the average for - the whole report period). This flag implies --empty (see below). It - is affected by --historical. It works best when showing just one ac- + the whole report period). This flag implies --empty (see below). It + is affected by --historical. It works best when showing just one ac- count and one commodity. - The --related/-r flag shows the other postings in the transactions of + The --related/-r flag shows the other postings in the transactions of the postings which would normally be shown. - The --invert flag negates all amounts. For example, it can be used on + The --invert flag negates all amounts. For example, it can be used on an income account where amounts are normally displayed as negative num- - bers. It's also useful to show postings on the checking account to- + bers. It's also useful to show postings on the checking account to- gether with the related account: $ hledger register --related --invert assets:checking @@ -2986,7 +2989,7 @@ COMMANDS 2008/01 income:salary $-1 $-1 2008/06 income:gifts $-1 $-2 - Periods with no activity, and summary postings with a zero amount, are + Periods with no activity, and summary postings with a zero amount, are not shown by default; use the --empty/-E flag to see them: $ hledger register --monthly income -E @@ -3003,7 +3006,7 @@ COMMANDS 2008/11 0 $-2 2008/12 0 $-2 - Often, you'll want to see just one line per interval. The --depth op- + Often, you'll want to see just one line per interval. The --depth op- tion helps with this, causing subaccounts to be aggregated: $ hledger register --monthly assets --depth 1h @@ -3011,17 +3014,17 @@ COMMANDS 2008/06 assets $-1 0 2008/12 assets $-1 $-1 - Note when using report intervals, if you specify start/end dates these - will be adjusted outward if necessary to contain a whole number of in- - tervals. This ensures that the first and last intervals are full + Note when using report intervals, if you specify start/end dates these + will be adjusted outward if necessary to contain a whole number of in- + tervals. This ensures that the first and last intervals are full length and comparable to the others in the report. Custom register output - register uses the full terminal width by default, except on windows. - You can override this by setting the COLUMNS environment variable (not + register uses the full terminal width by default, except on windows. + You can override this by setting the COLUMNS environment variable (not a bash shell variable) or by using the --width/-w option. - The description and account columns normally share the space equally + The description and account columns normally share the space equally (about half of (width - 40) each). You can adjust this by adding a de- scription width as part of --width's argument, comma-separated: --width W,D . Here's a diagram (won't display correctly in --help): @@ -3040,27 +3043,27 @@ COMMANDS $ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, and (experimental) + tions The output formats supported are txt, csv, and (experimental) json. register-match register-match Print the one posting whose transaction description is closest to DESC, - in the style of the register command. If there are multiple equally - good matches, it shows the most recent. Query options (options, not - arguments) can be used to restrict the search space. Helps ledger-au- + in the style of the register command. If there are multiple equally + good matches, it shows the most recent. Query options (options, not + arguments) can be used to restrict the search space. Helps ledger-au- tosync detect already-seen transactions when importing. rewrite rewrite Print all transactions, rewriting the postings of matched transactions. - For now the only rewrite available is adding new postings, like print + For now the only rewrite available is adding new postings, like print --auto. This is a start at a generic rewriter of transaction entries. It reads - the default journal and prints the transactions, like print, but adds + the default journal and prints the transactions, like print, but adds one or more specified postings to any transactions matching QUERY. The - posting amounts can be fixed, or a multiplier of the existing transac- + posting amounts can be fixed, or a multiplier of the existing transac- tion's first posting amount. Examples: @@ -3076,7 +3079,7 @@ COMMANDS (reserve:grocery) *0.25 ; reserve 25% for grocery (reserve:) *0.25 ; reserve 25% for grocery - Note the single quotes to protect the dollar sign from bash, and the + Note the single quotes to protect the dollar sign from bash, and the two spaces between account and amount. More: @@ -3086,16 +3089,16 @@ COMMANDS $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"' $ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify' - Argument for --add-posting option is a usual posting of transaction - with an exception for amount specification. More precisely, you can + Argument for --add-posting option is a usual posting of transaction + with an exception for amount specification. More precisely, you can use '*' (star symbol) before the amount to indicate that that this is a - factor for an amount of original matched posting. If the amount in- + factor for an amount of original matched posting. If the amount in- cludes a commodity name, the new posting amount will be in the new com- - modity; otherwise, it will be in the matched posting amount's commod- + modity; otherwise, it will be in the matched posting amount's commod- ity. Re-write rules in a file - During the run this tool will execute so called "Automated Transac- + During the run this tool will execute so called "Automated Transac- tions" found in any journal it process. I.e instead of specifying this operations in command line you can put them in a journal file. @@ -3110,7 +3113,7 @@ COMMANDS budget:gifts *-1 assets:budget *1 - Note that '=' (equality symbol) that is used instead of date in trans- + Note that '=' (equality symbol) that is used instead of date in trans- actions you usually write. It indicates the query by which you want to match the posting to add new ones. @@ -3123,12 +3126,12 @@ COMMANDS --add-posting 'assets:budget *1' \ > rewritten-tidy-output.journal - It is important to understand that relative order of such entries in - journal is important. You can re-use result of previously added post- + It is important to understand that relative order of such entries in + journal is important. You can re-use result of previously added post- ings. Diff output format - To use this tool for batch modification of your journal files you may + To use this tool for batch modification of your journal files you may find useful output in form of unified diff. $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33' @@ -3152,10 +3155,10 @@ COMMANDS If you'll pass this through patch tool you'll get transactions contain- ing the posting that matches your query be updated. Note that multiple - files might be update according to list of input files specified via + files might be update according to list of input files specified via --file options and include directives inside of these files. - Be careful. Whole transaction being re-formatted in a style of output + Be careful. Whole transaction being re-formatted in a style of output from hledger print. See also: @@ -3163,48 +3166,48 @@ COMMANDS https://github.com/simonmichael/hledger/issues/99 rewrite vs. print --auto - This command predates print --auto, and currently does much the same + This command predates print --auto, and currently does much the same thing, but with these differences: - o with multiple files, rewrite lets rules in any file affect all other - files. print --auto uses standard directive scoping; rules affect + o with multiple files, rewrite lets rules in any file affect all other + files. print --auto uses standard directive scoping; rules affect only child files. - o rewrite's query limits which transactions can be rewritten; all are + o rewrite's query limits which transactions can be rewritten; all are printed. print --auto's query limits which transactions are printed. - o rewrite applies rules specified on command line or in the journal. + o rewrite applies rules specified on command line or in the journal. print --auto applies rules specified in the journal. roi roi - Shows the time-weighted (TWR) and money-weighted (IRR) rate of return + Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on your investments. - This command assumes that you have account(s) that hold nothing but + This command assumes that you have account(s) that hold nothing but your investments and whenever you record current appraisal/valuation of these investments you offset unrealized profit and loss into account(s) that, again, hold nothing but unrealized profit and loss. - Any transactions affecting balance of investment account(s) and not - originating from unrealized profit and loss account(s) are assumed to + Any transactions affecting balance of investment account(s) and not + originating from unrealized profit and loss account(s) are assumed to be your investments or withdrawals. - At a minimum, you need to supply a query (which could be just an ac- + At a minimum, you need to supply a query (which could be just an ac- count name) to select your investments with --inv, and another query to identify your profit and loss transactions with --pnl. - It will compute and display the internalized rate of return (IRR) and - time-weighted rate of return (TWR) for your investments for the time - period requested. Both rates of return are annualized before display, + It will compute and display the internalized rate of return (IRR) and + time-weighted rate of return (TWR) for your investments for the time + period requested. Both rates of return are annualized before display, regardless of the length of reporting interval. stats stats Show some journal statistics. - The stats command displays summary information for the whole journal, - or a matched part of it. With a reporting interval, it shows a report + The stats command displays summary information for the whole journal, + or a matched part of it. With a reporting interval, it shows a report for each report period. Example: @@ -3222,35 +3225,35 @@ COMMANDS Commodities : 1 ($) Market prices : 12 ($) - This command also supports output destination and output format selec- + This command also supports output destination and output format selec- tion. tags tags - List the unique tag names used in the journal. With a TAGREGEX argu- + List the unique tag names used in the journal. With a TAGREGEX argu- ment, only tag names matching the regular expression (case insensitive) - are shown. With QUERY arguments, only transactions matching the query + are shown. With QUERY arguments, only transactions matching the query are considered. With the --values flag, the tags' unique values are listed instead. - With --parsed flag, all tags or values are shown in the order they are + With --parsed flag, all tags or values are shown in the order they are parsed from the input data, including duplicates. - With -E/--empty, any blank/empty values will also be shown, otherwise + With -E/--empty, any blank/empty values will also be shown, otherwise they are omitted. test test Run built-in unit tests. - This command runs the unit tests built in to hledger and hledger-lib, - printing the results on stdout. If any test fails, the exit code will + This command runs the unit tests built in to hledger and hledger-lib, + printing the results on stdout. If any test fails, the exit code will be non-zero. - This is mainly used by hledger developers, but you can also use it to - sanity-check the installed hledger executable on your platform. All - tests are expected to pass - if you ever see a failure, please report + This is mainly used by hledger developers, but you can also use it to + sanity-check the installed hledger executable on your platform. All + tests are expected to pass - if you ever see a failure, please report as a bug! This command also accepts tasty test runner options, written after a -- @@ -3259,35 +3262,35 @@ COMMANDS $ hledger test -- -pData.Amount --color=never - For help on these, see https://github.com/feuerbach/tasty#options (-- + For help on these, see https://github.com/feuerbach/tasty#options (-- --help currently doesn't show them). Add-on commands - hledger also searches for external add-on commands, and will include + hledger also searches for external add-on commands, and will include these in the commands list. These are programs or scripts in your PATH - whose name starts with hledger- and ends with a recognised file exten- + whose name starts with hledger- and ends with a recognised file exten- sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh). - Add-ons can be invoked like any hledger command, but there are a few + Add-ons can be invoked like any hledger command, but there are a few things to be aware of. Eg if the hledger-web add-on is installed, - o hledger -h web shows hledger's help, while hledger web -h shows + o hledger -h web shows hledger's help, while hledger web -h shows hledger-web's help. - o Flags specific to the add-on must have a preceding -- to hide them - from hledger. So hledger web --serve --port 9000 will be rejected; + o Flags specific to the add-on must have a preceding -- to hide them + from hledger. So hledger web --serve --port 9000 will be rejected; you must use hledger web -- --serve --port 9000. o You can always run add-ons directly if preferred: hledger-web --serve --port 9000. - Add-ons are a relatively easy way to add local features or experiment - with new ideas. They can be written in any language, but haskell - scripts have a big advantage: they can use the same hledger (and - haskell) library functions that built-in commands do, for command-line + Add-ons are a relatively easy way to add local features or experiment + with new ideas. They can be written in any language, but haskell + scripts have a big advantage: they can use the same hledger (and + haskell) library functions that built-in commands do, for command-line options, journal parsing, reporting, etc. - Two important add-ons are the hledger-ui and hledger-web user inter- + Two important add-ons are the hledger-ui and hledger-web user inter- faces. These are maintained and released along with hledger: ui @@ -3306,20 +3309,20 @@ COMMANDS hledger-interest generates interest transactions for an account accord- ing to various schemes. - A few more experimental or old add-ons can be found in hledger's bin/ + A few more experimental or old add-ons can be found in hledger's bin/ directory. These are typically prototypes and not guaranteed to work. ENVIRONMENT LEDGER_FILE The journal file path when not specified with -f. Default: - ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- + ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- nal). - A typical value is ~/DIR/YYYY.journal, where DIR is a version-con- - trolled finance directory and YYYY is the current year. Or ~/DIR/cur- + A typical value is ~/DIR/YYYY.journal, where DIR is a version-con- + trolled finance directory and YYYY is the current year. Or ~/DIR/cur- rent.journal, where current.journal is a symbolic link to YYYY.journal. On Mac computers, you can set this and other environment variables in a - more thorough way that also affects applications started from the GUI + more thorough way that also affects applications started from the GUI (say, an Emacs dock icon). Eg on MacOS Catalina I have a ~/.MacOSX/en- vironment.plist file containing @@ -3329,21 +3332,21 @@ ENVIRONMENT To see the effect you may need to killall Dock, or reboot. - COLUMNS The screen width used by the register command. Default: the + COLUMNS The screen width used by the register command. Default: the full terminal width. - NO_COLOR If this variable exists with any value, hledger will not use - ANSI color codes in terminal output. This overrides the + NO_COLOR If this variable exists with any value, hledger will not use + ANSI color codes in terminal output. This overrides the --color/--colour option. FILES - Reads data from one or more files in hledger journal, timeclock, time- - dot, or CSV format specified with -f, or $LEDGER_FILE, or - $HOME/.hledger.journal (on windows, perhaps + Reads data from one or more files in hledger journal, timeclock, time- + dot, or CSV format specified with -f, or $LEDGER_FILE, or + $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). LIMITATIONS - The need to precede addon command options with -- when invoked from + The need to precede addon command options with -- when invoked from hledger is awkward. When input data contains non-ascii characters, a suitable system locale @@ -3359,36 +3362,36 @@ LIMITATIONS In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger add. - Not all of Ledger's journal file syntax is supported. See file format + Not all of Ledger's journal file syntax is supported. See file format differences. - On large data files, hledger is slower and uses more memory than + On large data files, hledger is slower and uses more memory than Ledger. TROUBLESHOOTING - Here are some issues you might encounter when you run hledger (and re- - member you can also seek help from the IRC channel, mail list or bug + Here are some issues you might encounter when you run hledger (and re- + member you can also seek help from the IRC channel, mail list or bug tracker): Successfully installed, but "No command 'hledger' found" stack and cabal install binaries into a special directory, which should - be added to your PATH environment variable. Eg on unix-like systems, + be added to your PATH environment variable. Eg on unix-like systems, that is ~/.local/bin and ~/.cabal/bin respectively. I set a custom LEDGER_FILE, but hledger is still using the default file - LEDGER_FILE should be a real environment variable, not just a shell - variable. The command env | grep LEDGER_FILE should show it. You may + LEDGER_FILE should be a real environment variable, not just a shell + variable. The command env | grep LEDGER_FILE should show it. You may need to use export. Here's an explanation. - Getting errors like "Illegal byte sequence" or "Invalid or incomplete - multibyte or wide character" or "commitAndReleaseBuffer: invalid argu- + Getting errors like "Illegal byte sequence" or "Invalid or incomplete + multibyte or wide character" or "commitAndReleaseBuffer: invalid argu- ment (invalid character)" Programs compiled with GHC (hledger, haskell build tools, etc.) need to have a UTF-8-aware locale configured in the environment, otherwise they - will fail with these kinds of errors when they encounter non-ascii + will fail with these kinds of errors when they encounter non-ascii characters. - To fix it, set the LANG environment variable to some locale which sup- + To fix it, set the LANG environment variable to some locale which sup- ports UTF-8. The locale you choose must be installed on your system. Here's an example of setting LANG temporarily, on Ubuntu GNU/Linux: @@ -3403,8 +3406,8 @@ TROUBLESHOOTING POSIX $ LANG=en_US.utf8 hledger -f my.journal print # ensure it is used for this command - If available, C.UTF-8 will also work. If your preferred locale isn't - listed by locale -a, you might need to install it. Eg on Ubuntu/De- + If available, C.UTF-8 will also work. If your preferred locale isn't + listed by locale -a, you might need to install it. Eg on Ubuntu/De- bian: $ apt-get install language-pack-fr @@ -3424,8 +3427,8 @@ TROUBLESHOOTING $ echo "export LANG=en_US.utf8" >>~/.bash_profile $ bash --login - Exact spelling and capitalisation may be important. Note the differ- - ence on MacOS (UTF-8, not utf8). Some platforms (eg ubuntu) allow + Exact spelling and capitalisation may be important. Note the differ- + ence on MacOS (UTF-8, not utf8). Some platforms (eg ubuntu) allow variant spellings, but others (eg macos) require it to be exact: $ locale -a | grep -iE en_us.*utf @@ -3435,7 +3438,7 @@ TROUBLESHOOTING REPORTING BUGS - Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel + Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list) @@ -3449,7 +3452,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1) @@ -3457,4 +3460,4 @@ SEE ALSO -hledger 1.18.99 August 2020 hledger(1) +hledger 1.18.99 September 2020 hledger(1)