hledger-print
Print hledger journal data
TLDR
Show all transactions in the default journal file
Show transactions, with any implied amounts or costs made explicit
Show transactions from two specified files, with amounts converted to cost
Show $ transactions in *food* but not *groceries* accounts this month
Show transactions of amount 50 or more, with whole foods in their description
Show cleared transactions, with EUR amounts rounded and with decimal commas
Write transactions from foo.journal as a CSV file
SYNOPSIS
hledger print [OPTIONS] [QUERY...] [FILE...]
PARAMETERS
-f FILE, --file FILE
Specifies the path to the journal file(s) to be processed. If not specified, hledger looks for standard journal files like ~/.hledger.journal.
-p PERIOD, --period PERIOD
Filters transactions to include only those within a specified period (e.g., '2023/01/01 to 2023/01/31', 'this month', 'last year').
--balance
Displays the running balance of each account after every transaction, similar to a register report but integrated with the printed journal.
--pending
Includes transactions marked as pending (not yet reconciled) in the output. By default, pending transactions might be excluded by some reports.
--depth N
Limits the display depth of account names to a specified number of components (e.g., 'expenses:food' at depth 2).
--value
Converts and displays all amounts in a common value currency, useful for mixed-currency journals.
QUERY...
One or more query expressions used to filter the transactions. Queries can match account names, payees, transaction descriptions, tags, amounts, or any text within an entry (e.g., 'account:expenses', 'payee:supermarket', 'tag:reimbursable').
DESCRIPTION
hledger-print is a fundamental utility within the hledger plain text accounting system. It is used to display and format financial transactions and entries from one or more hledger journal files.
This command offers extensive filtering capabilities, allowing users to view specific transactions based on accounts, payees, dates, tags, or custom queries. It also provides various formatting options, enabling the display of transaction details, balances after each entry, pending transactions, or values in a specific currency. hledger-print is invaluable for reviewing journal contents, debugging accounting issues, or preparing custom reports by piping its output to other command-line tools.
CAVEATS
Due to its powerful filtering and formatting options, mastering hledger-print's full capabilities can take time. Complex queries might require careful syntax. For very large journal files, filtering with specific queries can significantly improve performance by reducing the data processed.
QUERYING POWER
The QUERY argument is extremely versatile, enabling highly specific transaction filtering. You can combine multiple queries, use regular expressions, and target different fields of a transaction, making hledger-print suitable for detailed analysis and custom reporting beyond simple display.
OUTPUT FORMATTING
While hledger-print offers many built-in options, its output is designed to be easily parsable by other command-line tools. This allows users to pipe the output to tools like grep, awk, sort, or custom scripts for advanced processing, formatting, or integration with other systems.
HISTORY
hledger, and by extension hledger-print, originated as a free software reimplementation of the popular ledger command-line accounting program. Developed with a focus on user-friendliness, robustness, and extensibility, hledger-print has been a core component since the early days of the hledger project. Its evolution has focused on enhancing filtering capabilities, output customization, and performance for large datasets, making it an indispensable tool for plain text accounting.
SEE ALSO
hledger(1), hledger-add(1), hledger-balance(1), hledger-register(1), hledger-stats(1), ledger(1)