Transaction looks like this:
2012/01/17 Night out Expenses:Movie (Sherlock Holmes) $6.50 Expenses:Dinner (SacWhich) $5.75 Expenses:Dinner (Tip) $0.15 Assets:Cash
The last line is the inverse of the sum of the preceding lines. Everything must add to zero. Imagine a file full of these transactions.
Then run the ledger command on the file:
ledger -f file.ledger -s balance.
This gives the balance of all the accounts. The -s means to show all child accounts.
To restrict which transactions count use -b and -e for beginning and end dates:
ledger -f file.ledger -s -b 2012/01/01 -e 2012/03/03 balance.