From the hledger manual’s QUERIES section:
One of hledger’s strengths is being able to quickly report on precise subsets of your data. Most commands accept an optional query expression, written as arguments after the command name, to filter the data by date, account name or other criteria.
Here are some more notes on this subject:
When query expressions aren’t expressive enough, it’s common practice to pipe two hledger commands together in a pipe. First a
Eg, which part of salary income went to checking ?
$ hledger print income:salary | hledger -f- balance assets:checking