LinuxCommandLibrary

hledger-print

Print hledger journal data

TLDR

Show all transactions in the default journal file

$ hledger print
copy

Show transactions, with any implied amounts or costs made explicit
$ hledger print [[-x|--explicit]] --infer-costs
copy

Show transactions from two specified files, with amounts converted to cost
$ hledger print [[-f|--file]] [path/to/2023.journal] [[-f|--file]] [path/to/2024.journal] [[-B|--cost]]
copy

Show $ transactions in *food* but not *groceries* accounts this month
$ hledger print cur:\\$ food not:groceries date:thismonth
copy

Show transactions of amount 50 or more, with whole foods in their description
$ hledger print amt:'>50' desc:'whole foods'
copy

Show cleared transactions, with EUR amounts rounded and with decimal commas
$ hledger print [[-C|--cleared]] --commodity '1000, EUR' --round hard
copy

Write transactions from foo.journal as a CSV file
$ hledger print [[-f|--file]] [path/to/foo.journal] [[-o|--output-file]] [path/to/output_file.csv]
copy

SYNOPSIS

hledger print [OPTIONS] [PATTERNS]

PARAMETERS

-f FILE, --file FILE
    Use this journal file instead of the default (~/.hledger.journal etc)

--rules-file FILE
    Read custom journal rules from this file

-b DATE, --begin DATE
    Include transactions on or after this smart date

-e DATE, --end DATE
    Exclude transactions after this smart date

-p STR, --period STR
    Report period ('monthly', '2023', 'quarterly', etc)

-t, --today
    Shortcut for --begin today

-T, --today-end
    Shortcut for --end today-end

--account REGEX
    Match these full account name(s)

--amt REGEX
    Match these amount values/strings

--desc REGEX
    Match description

--payee REGEX
    Match payee

--tag NAME[=REGEX]
    Match transaction tag

-U, --unmarked
    Match unmarked postings only

-C, --cleared
    Match cleared postings only

-P, --pending
    Match pending postings only

-R, --real
    Match postings with non-virtual accounts

-o FILE, --output-file FILE
    Write output to this file

--watch
    Watch for data changes and republish

DESCRIPTION

hledger print is a subcommand of the open-source hledger tool for plain text accounting. It displays matched transactions and postings from a journal file in a compact, readable format resembling the input syntax, but with enhancements like expanded periodic transaction comments, revealed generated market prices, and abbreviated account names for better printability.

This command is particularly useful for generating printable reports such as checks, invoices, bank statements, or transaction archives. It applies all standard hledger filters to select data by date ranges, accounts, amounts, descriptions, tags, and more. Unlike hledger journal, which preserves original whitespace, print uses tighter formatting suitable for paper or export.

Output goes to stdout by default, allowing easy piping to files, printers, or other tools. Supports --output-file for direct file writing. Works with generated data from auto postings and price directives, making it great for verification.

CAVEATS

Depends on hledger installation; patterns are space-separated; output format may vary slightly with journal complexity; no built-in pagination for large outputs.

EXAMPLES

hledger print # print all transactions
hledger print assets # print matching assets
hledger print -p '2023' -o output.journal # monthly 2023 to file

SMART DATES

Dates accept natural formats like '2023/1/15', 'last month', 'annually' for flexible period selection.

HISTORY

Developed by Simon Michael since 2007 as a Haskell reimplementation of John Wiegley's Ledger; print command available since early versions (0.20+, 2010); now at v1.33+ with ongoing enhancements for better formatting and compatibility.

SEE ALSO

hledger(1), ledger(1), hledger-journal(1)

Copied to clipboard