;regen manuals
This commit is contained in:
parent
c1a985f1c8
commit
e44c1cfae8
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
@ -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
|
||||
<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.
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1526,4 +1526,4 @@ SEE ALSO
|
||||
|
||||
|
||||
|
||||
hledger 1.18.99 August 2020 hledger_journal(5)
|
||||
hledger 1.18.99 September 2020 hledger_journal(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"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -78,4 +78,4 @@ SEE ALSO
|
||||
|
||||
|
||||
|
||||
hledger 1.18.99 August 2020 hledger_timeclock(5)
|
||||
hledger 1.18.99 September 2020 hledger_timeclock(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"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -161,4 +161,4 @@ SEE ALSO
|
||||
|
||||
|
||||
|
||||
hledger 1.18.99 August 2020 hledger_timedot(5)
|
||||
hledger 1.18.99 September 2020 hledger_timedot(5)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user