mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-07 21:15:19 +03:00
;update manuals
This commit is contained in:
parent
7cf7bcbf96
commit
895783ebe0
@ -75,7 +75,12 @@ T}
|
||||
T{
|
||||
\f[B]\f[CB]date-format\f[B]\f[R]
|
||||
T}@T{
|
||||
describe the format of CSV dates
|
||||
how to parse dates in CSV records
|
||||
T}
|
||||
T{
|
||||
\f[B]\f[CB]decimal-mark\f[B]\f[R]
|
||||
T}@T{
|
||||
the decimal mark used in CSV amounts, if ambiguous
|
||||
T}
|
||||
T{
|
||||
\f[B]\f[CB]newest-first\f[B]\f[R]
|
||||
@ -866,6 +871,27 @@ For the supported strptime syntax, see:
|
||||
.P
|
||||
.PD
|
||||
https://hackage.haskell.org/package/time/docs/Data-Time-Format.html#v:formatTime
|
||||
.SS \f[C]decimal-mark\f[R]
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
decimal-mark .
|
||||
\f[R]
|
||||
.fi
|
||||
.PP
|
||||
or:
|
||||
.IP
|
||||
.nf
|
||||
\f[C]
|
||||
decimal-mark ,
|
||||
\f[R]
|
||||
.fi
|
||||
.PP
|
||||
hledger automatically accepts either period or comma as a decimal mark
|
||||
when parsing numbers (cf Amounts).
|
||||
However if any numbers in the CSV contain digit group marks, such as
|
||||
thousand-separating commas, you should declare the decimal mark
|
||||
explicitly with this rule, to avoid misparsed numbers.
|
||||
.SS \f[C]newest-first\f[R]
|
||||
.PP
|
||||
hledger always sorts the generated transactions by date.
|
||||
|
@ -42,7 +42,9 @@ after the examples:
|
||||
*'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
|
||||
*'date-format'* how to parse dates in CSV records
|
||||
*'decimal-mark'* the decimal mark used in CSV amounts,
|
||||
if ambiguous
|
||||
*'newest-first'* disambiguate record order when there's
|
||||
only one date
|
||||
*'include'* inline another CSV rules file
|
||||
@ -387,6 +389,7 @@ Blank lines and lines beginning with '#' or ';' are ignored.
|
||||
* if table::
|
||||
* end::
|
||||
* date-format::
|
||||
* decimal-mark::
|
||||
* newest-first::
|
||||
* include::
|
||||
* balance-type::
|
||||
@ -787,7 +790,7 @@ if ,,,,
|
||||
end
|
||||
|
||||
|
||||
File: hledger_csv.info, Node: date-format, Next: newest-first, Prev: end, Up: CSV RULES
|
||||
File: hledger_csv.info, Node: date-format, Next: decimal-mark, Prev: end, Up: CSV RULES
|
||||
|
||||
2.8 'date-format'
|
||||
=================
|
||||
@ -818,11 +821,29 @@ date-format %-m/%-d/%Y %l:%M %p some other junk
|
||||
https://hackage.haskell.org/package/time/docs/Data-Time-Format.html#v:formatTime
|
||||
|
||||
|
||||
File: hledger_csv.info, Node: newest-first, Next: include, Prev: date-format, Up: CSV RULES
|
||||
File: hledger_csv.info, Node: decimal-mark, Next: newest-first, Prev: date-format, Up: CSV RULES
|
||||
|
||||
2.9 'newest-first'
|
||||
2.9 'decimal-mark'
|
||||
==================
|
||||
|
||||
decimal-mark .
|
||||
|
||||
or:
|
||||
|
||||
decimal-mark ,
|
||||
|
||||
hledger automatically accepts either period or comma as a decimal
|
||||
mark when parsing numbers (cf Amounts). However if any numbers in the
|
||||
CSV contain digit group marks, such as thousand-separating commas, you
|
||||
should declare the decimal mark explicitly with this rule, to avoid
|
||||
misparsed numbers.
|
||||
|
||||
|
||||
File: hledger_csv.info, Node: newest-first, Next: include, Prev: decimal-mark, Up: CSV RULES
|
||||
|
||||
2.10 '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
|
||||
@ -842,7 +863,7 @@ newest-first
|
||||
|
||||
File: hledger_csv.info, Node: include, Next: balance-type, Prev: newest-first, Up: CSV RULES
|
||||
|
||||
2.10 'include'
|
||||
2.11 'include'
|
||||
==============
|
||||
|
||||
include RULESFILE
|
||||
@ -865,7 +886,7 @@ include categorisation.rules
|
||||
|
||||
File: hledger_csv.info, Node: balance-type, Prev: include, Up: CSV RULES
|
||||
|
||||
2.11 'balance-type'
|
||||
2.12 'balance-type'
|
||||
===================
|
||||
|
||||
Balance assertions generated by assigning to balanceN are of the simple
|
||||
@ -1171,84 +1192,86 @@ command the user specified.
|
||||
|
||||
Tag Table:
|
||||
Node: Top72
|
||||
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 fields37417
|
||||
Ref: #referencing-other-fields37617
|
||||
Node: How CSV rules are evaluated38514
|
||||
Ref: #how-csv-rules-are-evaluated38687
|
||||
Node: EXAMPLES2793
|
||||
Ref: #examples2899
|
||||
Node: Basic3107
|
||||
Ref: #basic3207
|
||||
Node: Bank of Ireland3749
|
||||
Ref: #bank-of-ireland3884
|
||||
Node: Amazon5346
|
||||
Ref: #amazon5464
|
||||
Node: Paypal7183
|
||||
Ref: #paypal7277
|
||||
Node: CSV RULES14921
|
||||
Ref: #csv-rules15030
|
||||
Node: skip15342
|
||||
Ref: #skip15435
|
||||
Node: fields15810
|
||||
Ref: #fields15932
|
||||
Node: Transaction field names17097
|
||||
Ref: #transaction-field-names17257
|
||||
Node: Posting field names17368
|
||||
Ref: #posting-field-names17520
|
||||
Node: account17590
|
||||
Ref: #account17706
|
||||
Node: amount18243
|
||||
Ref: #amount18374
|
||||
Node: currency19481
|
||||
Ref: #currency19616
|
||||
Node: balance19822
|
||||
Ref: #balance19956
|
||||
Node: comment20273
|
||||
Ref: #comment20390
|
||||
Node: field assignment20553
|
||||
Ref: #field-assignment20696
|
||||
Node: separator21514
|
||||
Ref: #separator21649
|
||||
Node: if block22189
|
||||
Ref: #if-block22314
|
||||
Node: Matching the whole record22715
|
||||
Ref: #matching-the-whole-record22890
|
||||
Node: Matching individual fields23694
|
||||
Ref: #matching-individual-fields23898
|
||||
Node: Combining matchers24122
|
||||
Ref: #combining-matchers24318
|
||||
Node: Rules applied on successful match24631
|
||||
Ref: #rules-applied-on-successful-match24822
|
||||
Node: if table25476
|
||||
Ref: #if-table25595
|
||||
Node: end27333
|
||||
Ref: #end27445
|
||||
Node: date-format27669
|
||||
Ref: #date-format27801
|
||||
Node: decimal-mark28550
|
||||
Ref: #decimal-mark28693
|
||||
Node: newest-first29032
|
||||
Ref: #newest-first29173
|
||||
Node: include29856
|
||||
Ref: #include29987
|
||||
Node: balance-type30431
|
||||
Ref: #balance-type30551
|
||||
Node: TIPS31251
|
||||
Ref: #tips31333
|
||||
Node: Rapid feedback31589
|
||||
Ref: #rapid-feedback31706
|
||||
Node: Valid CSV32166
|
||||
Ref: #valid-csv32296
|
||||
Node: File Extension32488
|
||||
Ref: #file-extension32640
|
||||
Node: Reading multiple CSV files33069
|
||||
Ref: #reading-multiple-csv-files33254
|
||||
Node: Valid transactions33495
|
||||
Ref: #valid-transactions33673
|
||||
Node: Deduplicating importing34301
|
||||
Ref: #deduplicating-importing34480
|
||||
Node: Setting amounts35513
|
||||
Ref: #setting-amounts35682
|
||||
Node: Setting currency/commodity36669
|
||||
Ref: #setting-currencycommodity36861
|
||||
Node: Referencing other fields38035
|
||||
Ref: #referencing-other-fields38235
|
||||
Node: How CSV rules are evaluated39132
|
||||
Ref: #how-csv-rules-are-evaluated39305
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
@ -39,26 +39,28 @@ DESCRIPTION
|
||||
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
|
||||
date-format how to parse dates in CSV records
|
||||
decimal-mark the decimal mark used in CSV amounts, if
|
||||
ambiguous
|
||||
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
|
||||
@ -77,8 +79,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
|
||||
@ -120,13 +122,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"
|
||||
@ -178,7 +180,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"
|
||||
@ -333,9 +335,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
|
||||
@ -344,27 +346,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
|
||||
@ -377,52 +379,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
|
||||
@ -434,11 +436,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
|
||||
@ -447,14 +449,14 @@ 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 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
|
||||
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 ,
|
||||
@ -467,7 +469,7 @@ CSV RULES
|
||||
|
||||
separator TAB
|
||||
|
||||
If the input file has a .csv, .ssv or .tsv file extension (or a csv:,
|
||||
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.
|
||||
|
||||
@ -482,8 +484,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
|
||||
@ -491,16 +493,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).
|
||||
|
||||
@ -509,14 +511,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
|
||||
@ -525,8 +527,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)
|
||||
@ -556,11 +558,11 @@ CSV RULES
|
||||
MATCHER3,VALUE31,VALUE32,...,VALUE3n
|
||||
<empty line>
|
||||
|
||||
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.
|
||||
|
||||
@ -584,17 +586,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:
|
||||
@ -605,7 +607,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:
|
||||
|
||||
@ -616,10 +618,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
|
||||
@ -640,16 +642,29 @@ CSV RULES
|
||||
https://hackage.haskell.org/package/time/docs/Data-Time-For-
|
||||
mat.html#v:formatTime
|
||||
|
||||
decimal-mark
|
||||
decimal-mark .
|
||||
|
||||
or:
|
||||
|
||||
decimal-mark ,
|
||||
|
||||
hledger automatically accepts either period or comma as a decimal mark
|
||||
when parsing numbers (cf Amounts). However if any numbers in the CSV
|
||||
contain digit group marks, such as thousand-separating commas, you
|
||||
should declare the decimal mark explicitly with this rule, to avoid
|
||||
misparsed numbers.
|
||||
|
||||
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
|
||||
@ -662,9 +677,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
|
||||
@ -679,10 +694,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
|
||||
@ -697,19 +712,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)
|
||||
@ -717,9 +732,9 @@ TIPS
|
||||
o spaces outside the quotes are not allowed
|
||||
|
||||
File Extension
|
||||
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:,
|
||||
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
|
||||
@ -728,48 +743,48 @@ TIPS
|
||||
|
||||
$ cat foo | hledger -f ssv:- foo
|
||||
|
||||
You can override the file extension with a separator rule if needed.
|
||||
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,
|
||||
hledger will look for a correspondingly-named rules file for each CSV
|
||||
file. But if you use the --rules-file option, that rules file will be
|
||||
If you use multiple -f options to read multiple CSV files at once,
|
||||
hledger will look for a correspondingly-named rules file for each CSV
|
||||
file. But if you use the --rules-file option, that rules file will be
|
||||
used for all the CSV files.
|
||||
|
||||
Valid transactions
|
||||
After reading a CSV file, hledger post-processes and validates the gen-
|
||||
erated journal entries as it would for a journal file - balancing them,
|
||||
applying balance assignments, and canonicalising amount styles. Any
|
||||
errors at this stage will be reported in the usual way, displaying the
|
||||
applying balance assignments, and canonicalising amount styles. Any
|
||||
errors at this stage will be reported in the usual way, displaying the
|
||||
problem entry.
|
||||
|
||||
There is one exception: balance assertions, if you have generated them,
|
||||
will not be checked, since normally these will work only when the CSV
|
||||
data is part of the main journal. If you do need to check balance as-
|
||||
will not be checked, since normally these will work only when the CSV
|
||||
data is part of the main journal. If you do need to check balance as-
|
||||
sertions generated from CSV right away, pipe into another hledger:
|
||||
|
||||
$ hledger -f file.csv print | hledger -f- print
|
||||
|
||||
Deduplicating, importing
|
||||
When you download a CSV file periodically, eg to get your latest bank
|
||||
transactions, the new file may overlap with the old one, containing
|
||||
When you download a CSV file periodically, eg to get your latest bank
|
||||
transactions, the new file may overlap with the old one, containing
|
||||
some of the same records.
|
||||
|
||||
The import command will (a) detect the new transactions, and (b) append
|
||||
just those transactions to your main journal. It is idempotent, so you
|
||||
don't have to remember how many times you ran it or with which version
|
||||
of the CSV. (It keeps state in a hidden .latest.FILE.csv file.) This
|
||||
don't have to remember how many times you ran it or with which version
|
||||
of the CSV. (It keeps state in a hidden .latest.FILE.csv file.) This
|
||||
is the easiest way to import CSV data. Eg:
|
||||
|
||||
# download the latest CSV files, then run this command.
|
||||
# Note, no -f flags needed here.
|
||||
$ hledger import *.csv [--dry]
|
||||
|
||||
This method works for most CSV files. (Where records have a stable
|
||||
This method works for most CSV files. (Where records have a stable
|
||||
chronological order, and new records appear only at the new end.)
|
||||
|
||||
A number of other tools and workflows, hledger-specific and otherwise,
|
||||
A number of other tools and workflows, hledger-specific and otherwise,
|
||||
exist for converting, deduplicating, classifying and managing CSV data.
|
||||
See:
|
||||
|
||||
@ -780,30 +795,30 @@ TIPS
|
||||
Setting amounts
|
||||
A posting amount can be set in one of these ways:
|
||||
|
||||
o by assigning (with a fields list or field assignment) to amountN
|
||||
o by assigning (with a fields list or field assignment) to amountN
|
||||
(posting N's amount) or amount (posting 1's amount)
|
||||
|
||||
o by assigning to amountN-in and amountN-out (or amount-in and amount-
|
||||
out). For each CSV record, whichever of these has a non-zero value
|
||||
will be used, with appropriate sign. If both contain a non-zero
|
||||
o by assigning to amountN-in and amountN-out (or amount-in and amount-
|
||||
out). For each CSV record, whichever of these has a non-zero value
|
||||
will be used, with appropriate sign. If both contain a non-zero
|
||||
value, this may not work.
|
||||
|
||||
o by assigning to balanceN (or balance) instead of the above, setting
|
||||
the amount indirectly via a balance assignment. If you do this the
|
||||
o by assigning to balanceN (or balance) instead of the above, setting
|
||||
the amount indirectly via a balance assignment. If you do this the
|
||||
default account name may be wrong, so you should set that explicitly.
|
||||
|
||||
There is some special handling for an amount's sign:
|
||||
|
||||
o If an amount value is parenthesised, it will be de-parenthesised and
|
||||
o If an amount value is parenthesised, it will be de-parenthesised and
|
||||
sign-flipped.
|
||||
|
||||
o If an amount value begins with a double minus sign, those cancel out
|
||||
o If an amount value begins with a double minus sign, those cancel out
|
||||
and are removed.
|
||||
|
||||
o If an amount value begins with a plus sign, that will be removed
|
||||
|
||||
Setting currency/commodity
|
||||
If the currency/commodity symbol is included in the CSV's amount
|
||||
If the currency/commodity symbol is included in the CSV's amount
|
||||
field(s):
|
||||
|
||||
2020-01-01,foo,$123.00
|
||||
@ -822,7 +837,7 @@ TIPS
|
||||
2020-01-01,foo,USD,123.00
|
||||
|
||||
You can assign that to the currency pseudo-field, which has the special
|
||||
effect of prepending itself to every amount in the transaction (on the
|
||||
effect of prepending itself to every amount in the transaction (on the
|
||||
left, with no separating space):
|
||||
|
||||
fields date,description,currency,amount
|
||||
@ -831,7 +846,7 @@ TIPS
|
||||
expenses:unknown USD123.00
|
||||
income:unknown USD-123.00
|
||||
|
||||
Or, you can use a field assignment to construct the amount yourself,
|
||||
Or, you can use a field assignment to construct the amount yourself,
|
||||
with more control. Eg to put the symbol on the right, and separated by
|
||||
a space:
|
||||
|
||||
@ -842,13 +857,13 @@ TIPS
|
||||
expenses:unknown 123.00 USD
|
||||
income:unknown -123.00 USD
|
||||
|
||||
Note we used a temporary field name (cur) that is not currency - that
|
||||
Note we used a temporary field name (cur) that is not currency - that
|
||||
would trigger the prepending effect, which we don't want here.
|
||||
|
||||
Referencing other fields
|
||||
In field assignments, you can interpolate only CSV fields, not hledger
|
||||
fields. In the example below, there's both a CSV field and a hledger
|
||||
field named amount1, but %amount1 always means the CSV field, not the
|
||||
In field assignments, you can interpolate only CSV fields, not hledger
|
||||
fields. In the example below, there's both a CSV field and a hledger
|
||||
field named amount1, but %amount1 always means the CSV field, not the
|
||||
hledger field:
|
||||
|
||||
# Name the third CSV field "amount1"
|
||||
@ -860,7 +875,7 @@ TIPS
|
||||
# Set comment to the CSV amount1 (not the amount1 assigned above)
|
||||
comment %amount1
|
||||
|
||||
Here, since there's no CSV amount1 field, %amount1 will produce a lit-
|
||||
Here, since there's no CSV amount1 field, %amount1 will produce a lit-
|
||||
eral "amount1":
|
||||
|
||||
fields date,description,csvamount
|
||||
@ -868,7 +883,7 @@ TIPS
|
||||
# Can't interpolate amount1 here
|
||||
comment %amount1
|
||||
|
||||
When there are multiple field assignments to the same hledger field,
|
||||
When there are multiple field assignments to the same hledger field,
|
||||
only the last one takes effect. Here, comment's value will be be B, or
|
||||
C if "something" is matched, but never A:
|
||||
|
||||
@ -878,14 +893,14 @@ TIPS
|
||||
comment C
|
||||
|
||||
How CSV rules are evaluated
|
||||
Here's how to think of CSV rules being evaluated (if you really need
|
||||
Here's how to think of CSV rules being evaluated (if you really need
|
||||
to). First,
|
||||
|
||||
o include - all includes are inlined, from top to bottom, depth first.
|
||||
(At each include point the file is inlined and scanned for further
|
||||
o include - all includes are inlined, from top to bottom, depth first.
|
||||
(At each include point the file is inlined and scanned for further
|
||||
includes, recursively, before proceeding.)
|
||||
|
||||
Then "global" rules are evaluated, top to bottom. If a rule is re-
|
||||
Then "global" rules are evaluated, top to bottom. If a rule is re-
|
||||
peated, the last one wins:
|
||||
|
||||
o skip (at top level)
|
||||
@ -899,30 +914,30 @@ TIPS
|
||||
|
||||
Then for each CSV record in turn:
|
||||
|
||||
o test all if blocks. If any of them contain a end rule, skip all re-
|
||||
maining CSV records. Otherwise if any of them contain a skip rule,
|
||||
skip that many CSV records. If there are multiple matched skip
|
||||
o test all if blocks. If any of them contain a end rule, skip all re-
|
||||
maining CSV records. Otherwise if any of them contain a skip rule,
|
||||
skip that many CSV records. If there are multiple matched skip
|
||||
rules, the first one wins.
|
||||
|
||||
o collect all field assignments at top level and in matched if blocks.
|
||||
When there are multiple assignments for a field, keep only the last
|
||||
o collect all field assignments at top level and in matched if blocks.
|
||||
When there are multiple assignments for a field, keep only the last
|
||||
one.
|
||||
|
||||
o compute a value for each hledger field - either the one that was as-
|
||||
o compute a value for each hledger field - either the one that was as-
|
||||
signed to it (and interpolate the %CSVFIELDNAME references), or a de-
|
||||
fault
|
||||
|
||||
o generate a synthetic hledger transaction from these values.
|
||||
|
||||
This is all part of the CSV reader, one of several readers hledger can
|
||||
use to parse input files. When all files have been read successfully,
|
||||
the transactions are passed as input to whichever hledger command the
|
||||
This is all part of the CSV reader, one of several readers hledger can
|
||||
use to parse input files. When all files have been read successfully,
|
||||
the transactions are passed as input to whichever hledger command the
|
||||
user specified.
|
||||
|
||||
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@ -936,7 +951,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)
|
||||
|
||||
|
@ -1588,10 +1588,12 @@ T}
|
||||
If you want intervals that start on arbitrary day of your choosing and
|
||||
span a week, month or year, you need to use any of the following:
|
||||
.PP
|
||||
\f[C]every Nth day of week\f[R], \f[C]every <weekday>\f[R],
|
||||
\f[C]every Nth day of week\f[R], \f[C]every WEEKDAYNAME\f[R] (eg
|
||||
\f[C]mon|tue|wed|thu|fri|sat|sun\f[R]),
|
||||
\f[C]every Nth day [of month]\f[R],
|
||||
\f[C]every Nth weekday [of month]\f[R], \f[C]every MM/DD [of year]\f[R],
|
||||
\f[C]every Nth MMM [of year]\f[R], \f[C]every MMM Nth [of year]\f[R].
|
||||
\f[C]every Nth WEEKDAYNAME [of month]\f[R],
|
||||
\f[C]every MM/DD [of year]\f[R], \f[C]every Nth MMM [of year]\f[R],
|
||||
\f[C]every MMM Nth [of year]\f[R].
|
||||
.PP
|
||||
Examples:
|
||||
.PP
|
||||
@ -2113,7 +2115,7 @@ Related: #329, #1083.
|
||||
.PP
|
||||
.TS
|
||||
tab(@);
|
||||
lw(11.7n) lw(11.2n) lw(11.9n) lw(13.1n) lw(12.4n) lw(9.8n).
|
||||
lw(7.4n) lw(11.7n) lw(19.6n) lw(6.8n) lw(19.6n) lw(5.0n).
|
||||
T{
|
||||
Report type
|
||||
T}@T{
|
||||
@ -2258,15 +2260,35 @@ T}@T{
|
||||
value at DATE/today of sums of postings
|
||||
T}
|
||||
T{
|
||||
balances (with report interval)
|
||||
balances changes (with report interval)
|
||||
T}@T{
|
||||
sums of costs
|
||||
sums of costs of postings in interval
|
||||
T}@T{
|
||||
value at period ends of sums of postings
|
||||
value at period ends of sums of postings before period end minus value
|
||||
at period starts of sums of all postings before period start
|
||||
T}@T{
|
||||
not supported
|
||||
T}@T{
|
||||
value at period ends of sums of postings
|
||||
value at period ends of sums of postings before period end minus value
|
||||
at period starts of sums of all postings before period start
|
||||
T}@T{
|
||||
value at DATE/today of sums of postings
|
||||
T}
|
||||
T{
|
||||
end balances (with report interval and --cumulative or -H)
|
||||
T}@T{
|
||||
sums of costs of postings from report start (or before report start with
|
||||
-H) and interval end
|
||||
T}@T{
|
||||
value at period ends of sums of all postings before period end (minus
|
||||
value at report start of of sums of all postings before report start
|
||||
with --cumulative)
|
||||
T}@T{
|
||||
not supported
|
||||
T}@T{
|
||||
value at period ends of sums of all postings before period end (minus
|
||||
value at report start of of sums of all postings before report start
|
||||
with --cumulative)
|
||||
T}@T{
|
||||
value at DATE/today of sums of postings
|
||||
T}
|
||||
@ -2275,11 +2297,11 @@ starting balances (with report interval and -H)
|
||||
T}@T{
|
||||
sums of costs of postings before report start
|
||||
T}@T{
|
||||
sums of postings before report start
|
||||
value at report start of sums of all postings before report start
|
||||
T}@T{
|
||||
not supported
|
||||
T}@T{
|
||||
sums of postings before report start
|
||||
value at report start of sums of all postings before report start
|
||||
T}@T{
|
||||
sums of postings before report start
|
||||
T}
|
||||
|
@ -1305,9 +1305,10 @@ end on the last one, as described above.
|
||||
If you want intervals that start on arbitrary day of your choosing
|
||||
and span a week, month or year, you need to use any of the following:
|
||||
|
||||
'every Nth day of week', 'every <weekday>', 'every Nth day [of
|
||||
month]', 'every Nth weekday [of month]', 'every MM/DD [of year]', 'every
|
||||
Nth MMM [of year]', 'every MMM Nth [of year]'.
|
||||
'every Nth day of week', 'every WEEKDAYNAME' (eg
|
||||
'mon|tue|wed|thu|fri|sat|sun'), 'every Nth day [of month]', 'every Nth
|
||||
WEEKDAYNAME [of month]', 'every MM/DD [of year]', 'every Nth MMM [of
|
||||
year]', 'every MMM Nth [of year]'.
|
||||
|
||||
Examples:
|
||||
|
||||
@ -1785,76 +1786,103 @@ sideways.) It may be useful when troubleshooting. If you find
|
||||
problems, please report them, ideally with a reproducible example.
|
||||
Related: #329, #1083.
|
||||
|
||||
Report '-B', '-V', '-X' '--value=then' '--value=end' '--value=DATE',
|
||||
type '--value=cost' '--value=now'
|
||||
-------------------------------------------------------------------------------
|
||||
Report '-B', '-V', '-X' '--value=then''--value=end' '--value=DATE',
|
||||
type '--value=cost' '--value=now'
|
||||
------------------------------------------------------------------------------
|
||||
*print*
|
||||
posting cost value at value at value at value at
|
||||
amounts report end posting date report or DATE/today
|
||||
or today journal end
|
||||
balance unchanged unchanged unchanged unchanged unchanged
|
||||
posting cost value at report value value at report or value
|
||||
amounts end or today at journal end at
|
||||
posting DATE/today
|
||||
date
|
||||
balance unchanged unchanged unchangedunchanged unchanged
|
||||
assertions
|
||||
/
|
||||
assignments
|
||||
*register*
|
||||
starting cost value at not value at value at
|
||||
balance day before supported day before DATE/today
|
||||
(with -H) report or report or
|
||||
journal journal
|
||||
start start
|
||||
posting cost value at value at value at value at
|
||||
amounts report end posting date report or DATE/today
|
||||
(no report or today journal end
|
||||
starting cost value at day not value at day value
|
||||
balance before report or supportedbefore report or at
|
||||
(with journal start journal start DATE/today
|
||||
-H)
|
||||
posting cost value at report value value at report or value
|
||||
amounts end or today at journal end at
|
||||
(no posting DATE/today
|
||||
report date
|
||||
interval)
|
||||
summary summarised value at sum of value at value at
|
||||
posting cost period postings in period ends DATE/today
|
||||
amounts ends interval,
|
||||
(with valued at
|
||||
report interval
|
||||
interval) start
|
||||
running sum/average sum/average sum/average sum/average sum/average
|
||||
total/averageof of of displayed of of
|
||||
displayed displayed values displayed displayed
|
||||
values values values values
|
||||
summary summarised value at period sum value at period value
|
||||
posting cost ends of ends at
|
||||
amounts postings DATE/today
|
||||
(with in
|
||||
report interval,
|
||||
interval) valued
|
||||
at
|
||||
interval
|
||||
start
|
||||
running sum/average sum/average of sum/averagesum/average of sum/average
|
||||
total/averageof displayed values of displayed values of
|
||||
displayed displayed displayed
|
||||
values values values
|
||||
*balance
|
||||
(bs, bse,
|
||||
cf, is..)*
|
||||
balances sums of value at not value at value at
|
||||
(no report costs report end supported report or DATE/today
|
||||
interval) or today journal end of sums
|
||||
of sums of of sums of of
|
||||
postings postings postings
|
||||
balances sums of value at not value at value at
|
||||
(with costs period supported period ends DATE/today
|
||||
report ends of of sums of of sums
|
||||
interval) sums of postings of
|
||||
postings postings
|
||||
starting sums of sums of not sums of sums of
|
||||
balances costs of postings supported postings postings
|
||||
(with postings before before before
|
||||
report before report report report
|
||||
interval report start start start
|
||||
and -H) start
|
||||
budget like like not like like
|
||||
amounts balances balances supported balances balances
|
||||
(bs,
|
||||
bse,
|
||||
cf,
|
||||
is..)*
|
||||
balances sums of value at report not value at report or value
|
||||
(no costs end or today of supportedjournal end of at
|
||||
report sums of postings sums of postings DATE/today
|
||||
interval) of
|
||||
sums
|
||||
of
|
||||
postings
|
||||
balances sums of value at period not value at period value
|
||||
changes costs of ends of sums of supportedends of sums of at
|
||||
(with postings postings before postings before DATE/today
|
||||
report in period end minus period end minus of
|
||||
interval)interval value at period value at period sums
|
||||
starts of sums of starts of sums of of
|
||||
all postings all postings postings
|
||||
before period before period
|
||||
start start
|
||||
end sums of value at period not value at period value
|
||||
balances costs of ends of sums of supportedends of sums of at
|
||||
(with postings all postings all postings DATE/today
|
||||
report from before period end before period end of
|
||||
interval report (minus value at (minus value at sums
|
||||
and start (or report start of of report start of of of
|
||||
-cumulativebefore sums of all sums of all postings
|
||||
or -H) report postings before postings before
|
||||
start with report start with report start with
|
||||
-H) and -cumulative) -cumulative)
|
||||
interval
|
||||
end
|
||||
starting sums of value at report not value at report sums
|
||||
balances costs of start of sums of supportedstart of sums of of
|
||||
(with postings all postings all postings postings
|
||||
report before before report before report before
|
||||
interval report start start report
|
||||
and start start
|
||||
-H)
|
||||
budget like like balances not like balances like
|
||||
amounts balances supported balances
|
||||
with
|
||||
-budget
|
||||
grand sum of sum of not sum of sum of
|
||||
total (no displayed displayed supported displayed displayed
|
||||
report values values values values
|
||||
grand sum of sum of displayed not sum of displayed sum
|
||||
total displayed values supportedvalues of
|
||||
(no values displayed
|
||||
report values
|
||||
interval)
|
||||
row sums/averagessums/averagesnot sums/averages sums/averages
|
||||
totals/averagesof of supported of of
|
||||
(with displayed displayed displayed displayed
|
||||
report values values values values
|
||||
row sums/averagessums/averages of not sums/averages of sums/averages
|
||||
totals/averagesof displayed values supporteddisplayed values of
|
||||
(with displayed displayed
|
||||
report values values
|
||||
interval)
|
||||
column sums of sums of not sums of sums of
|
||||
totals displayed displayed supported displayed displayed
|
||||
values values values values
|
||||
grand sum/average sum/average not sum/average sum/average
|
||||
total/averageof column of column supported of column of
|
||||
totals totals totals column
|
||||
totals
|
||||
column sums of sums of displayed not sums of displayed sums
|
||||
totals displayed values supportedvalues of
|
||||
values displayed
|
||||
values
|
||||
grand sum/average sum/average of not sum/average of sum/average
|
||||
total/averageof columncolumn totals supportedcolumn totals of
|
||||
totals column
|
||||
totals
|
||||
|
||||
*Glossary:*
|
||||
|
||||
@ -4132,152 +4160,152 @@ 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 report75005
|
||||
Ref: #classic-balance-report75178
|
||||
Node: Customising the classic balance report76502
|
||||
Ref: #customising-the-classic-balance-report76730
|
||||
Node: Colour support78806
|
||||
Ref: #colour-support78973
|
||||
Node: Flat mode79069
|
||||
Ref: #flat-mode79217
|
||||
Node: Depth limited balance reports79630
|
||||
Ref: #depth-limited-balance-reports79815
|
||||
Node: Percentages80271
|
||||
Ref: #percentages80428
|
||||
Node: Sorting by amount81565
|
||||
Ref: #sorting-by-amount81731
|
||||
Node: Multicolumn balance report82225
|
||||
Ref: #multicolumn-balance-report82411
|
||||
Node: Budget report88008
|
||||
Ref: #budget-report88151
|
||||
Node: Nested budgets93417
|
||||
Ref: #nested-budgets93529
|
||||
Ref: #output-format-297012
|
||||
Node: balancesheet97209
|
||||
Ref: #balancesheet97345
|
||||
Node: balancesheetequity98857
|
||||
Ref: #balancesheetequity99006
|
||||
Node: cashflow100082
|
||||
Ref: #cashflow100210
|
||||
Node: check-dates101426
|
||||
Ref: #check-dates101553
|
||||
Node: check-dupes101832
|
||||
Ref: #check-dupes101958
|
||||
Node: close102251
|
||||
Ref: #close102359
|
||||
Node: close usage103881
|
||||
Ref: #close-usage103974
|
||||
Node: codes106787
|
||||
Ref: #codes106895
|
||||
Node: commodities107607
|
||||
Ref: #commodities107734
|
||||
Node: descriptions107816
|
||||
Ref: #descriptions107944
|
||||
Node: diff108248
|
||||
Ref: #diff108354
|
||||
Node: files109401
|
||||
Ref: #files109501
|
||||
Node: help109648
|
||||
Ref: #help109748
|
||||
Node: import110829
|
||||
Ref: #import110943
|
||||
Node: Importing balance assignments111836
|
||||
Ref: #importing-balance-assignments111984
|
||||
Node: incomestatement112633
|
||||
Ref: #incomestatement112766
|
||||
Node: notes114111
|
||||
Ref: #notes114224
|
||||
Node: payees114592
|
||||
Ref: #payees114698
|
||||
Node: prices115118
|
||||
Ref: #prices115224
|
||||
Node: print115565
|
||||
Ref: #print115675
|
||||
Node: print-unique120471
|
||||
Ref: #print-unique120597
|
||||
Node: register120882
|
||||
Ref: #register121009
|
||||
Node: Custom register output125458
|
||||
Ref: #custom-register-output125587
|
||||
Node: register-match126924
|
||||
Ref: #register-match127058
|
||||
Node: rewrite127409
|
||||
Ref: #rewrite127524
|
||||
Node: Re-write rules in a file129379
|
||||
Ref: #re-write-rules-in-a-file129513
|
||||
Node: Diff output format130723
|
||||
Ref: #diff-output-format130892
|
||||
Node: rewrite vs print --auto131984
|
||||
Ref: #rewrite-vs.-print---auto132163
|
||||
Node: roi132719
|
||||
Ref: #roi132817
|
||||
Node: stats133829
|
||||
Ref: #stats133928
|
||||
Node: tags134716
|
||||
Ref: #tags134814
|
||||
Node: test135333
|
||||
Ref: #test135441
|
||||
Node: Add-on commands136188
|
||||
Ref: #add-on-commands136305
|
||||
Node: ui137648
|
||||
Ref: #ui137736
|
||||
Node: web137790
|
||||
Ref: #web137893
|
||||
Node: iadd138009
|
||||
Ref: #iadd138120
|
||||
Node: interest138202
|
||||
Ref: #interest138309
|
||||
Node: ENVIRONMENT138549
|
||||
Ref: #environment138661
|
||||
Node: FILES139646
|
||||
Ref: #files-1139749
|
||||
Node: LIMITATIONS139962
|
||||
Ref: #limitations140081
|
||||
Node: TROUBLESHOOTING140823
|
||||
Ref: #troubleshooting140936
|
||||
Node: Depth limiting45961
|
||||
Ref: #depth-limiting46105
|
||||
Node: Pivoting46437
|
||||
Ref: #pivoting46560
|
||||
Node: Valuation48236
|
||||
Ref: #valuation48338
|
||||
Node: -B Cost49027
|
||||
Ref: #b-cost49131
|
||||
Node: -V Value49264
|
||||
Ref: #v-value49410
|
||||
Node: -X Value in specified commodity49605
|
||||
Ref: #x-value-in-specified-commodity49804
|
||||
Node: Valuation date49953
|
||||
Ref: #valuation-date50121
|
||||
Node: Market prices50531
|
||||
Ref: #market-prices50711
|
||||
Node: --infer-value market prices from transactions51488
|
||||
Ref: #infer-value-market-prices-from-transactions51737
|
||||
Node: Valuation commodity53019
|
||||
Ref: #valuation-commodity53228
|
||||
Node: Simple valuation examples54454
|
||||
Ref: #simple-valuation-examples54656
|
||||
Node: --value Flexible valuation55315
|
||||
Ref: #value-flexible-valuation55523
|
||||
Node: More valuation examples57470
|
||||
Ref: #more-valuation-examples57679
|
||||
Node: Effect of valuation on reports59684
|
||||
Ref: #effect-of-valuation-on-reports59872
|
||||
Node: COMMANDS67137
|
||||
Ref: #commands67245
|
||||
Node: accounts68353
|
||||
Ref: #accounts68451
|
||||
Node: activity69150
|
||||
Ref: #activity69260
|
||||
Node: add69643
|
||||
Ref: #add69744
|
||||
Node: aregister72537
|
||||
Ref: #aregister72649
|
||||
Node: aregister and custom posting dates74022
|
||||
Ref: #aregister-and-custom-posting-dates74195
|
||||
Ref: #output-format-174788
|
||||
Node: balance75193
|
||||
Ref: #balance75310
|
||||
Node: Classic balance report76790
|
||||
Ref: #classic-balance-report76963
|
||||
Node: Customising the classic balance report78287
|
||||
Ref: #customising-the-classic-balance-report78515
|
||||
Node: Colour support80591
|
||||
Ref: #colour-support80758
|
||||
Node: Flat mode80854
|
||||
Ref: #flat-mode81002
|
||||
Node: Depth limited balance reports81415
|
||||
Ref: #depth-limited-balance-reports81600
|
||||
Node: Percentages82056
|
||||
Ref: #percentages82213
|
||||
Node: Sorting by amount83350
|
||||
Ref: #sorting-by-amount83516
|
||||
Node: Multicolumn balance report84010
|
||||
Ref: #multicolumn-balance-report84196
|
||||
Node: Budget report89793
|
||||
Ref: #budget-report89936
|
||||
Node: Nested budgets95202
|
||||
Ref: #nested-budgets95314
|
||||
Ref: #output-format-298797
|
||||
Node: balancesheet98994
|
||||
Ref: #balancesheet99130
|
||||
Node: balancesheetequity100642
|
||||
Ref: #balancesheetequity100791
|
||||
Node: cashflow101867
|
||||
Ref: #cashflow101995
|
||||
Node: check-dates103211
|
||||
Ref: #check-dates103338
|
||||
Node: check-dupes103617
|
||||
Ref: #check-dupes103743
|
||||
Node: close104036
|
||||
Ref: #close104144
|
||||
Node: close usage105666
|
||||
Ref: #close-usage105759
|
||||
Node: codes108572
|
||||
Ref: #codes108680
|
||||
Node: commodities109392
|
||||
Ref: #commodities109519
|
||||
Node: descriptions109601
|
||||
Ref: #descriptions109729
|
||||
Node: diff110033
|
||||
Ref: #diff110139
|
||||
Node: files111186
|
||||
Ref: #files111286
|
||||
Node: help111433
|
||||
Ref: #help111533
|
||||
Node: import112614
|
||||
Ref: #import112728
|
||||
Node: Importing balance assignments113621
|
||||
Ref: #importing-balance-assignments113769
|
||||
Node: incomestatement114418
|
||||
Ref: #incomestatement114551
|
||||
Node: notes115896
|
||||
Ref: #notes116009
|
||||
Node: payees116377
|
||||
Ref: #payees116483
|
||||
Node: prices116903
|
||||
Ref: #prices117009
|
||||
Node: print117350
|
||||
Ref: #print117460
|
||||
Node: print-unique122256
|
||||
Ref: #print-unique122382
|
||||
Node: register122667
|
||||
Ref: #register122794
|
||||
Node: Custom register output127243
|
||||
Ref: #custom-register-output127372
|
||||
Node: register-match128709
|
||||
Ref: #register-match128843
|
||||
Node: rewrite129194
|
||||
Ref: #rewrite129309
|
||||
Node: Re-write rules in a file131164
|
||||
Ref: #re-write-rules-in-a-file131298
|
||||
Node: Diff output format132508
|
||||
Ref: #diff-output-format132677
|
||||
Node: rewrite vs print --auto133769
|
||||
Ref: #rewrite-vs.-print---auto133948
|
||||
Node: roi134504
|
||||
Ref: #roi134602
|
||||
Node: stats135614
|
||||
Ref: #stats135713
|
||||
Node: tags136501
|
||||
Ref: #tags136599
|
||||
Node: test137118
|
||||
Ref: #test137226
|
||||
Node: Add-on commands137973
|
||||
Ref: #add-on-commands138090
|
||||
Node: ui139433
|
||||
Ref: #ui139521
|
||||
Node: web139575
|
||||
Ref: #web139678
|
||||
Node: iadd139794
|
||||
Ref: #iadd139905
|
||||
Node: interest139987
|
||||
Ref: #interest140094
|
||||
Node: ENVIRONMENT140334
|
||||
Ref: #environment140446
|
||||
Node: FILES141431
|
||||
Ref: #files-1141534
|
||||
Node: LIMITATIONS141747
|
||||
Ref: #limitations141866
|
||||
Node: TROUBLESHOOTING142608
|
||||
Ref: #troubleshooting142721
|
||||
|
||||
End Tag Table
|
||||
|
||||
|
1041
hledger/hledger.txt
1041
hledger/hledger.txt
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user