Skip to content

Instantly share code, notes, and snippets.

@multidis
Forked from agaviria/Ledger_3_commands.dat
Created May 24, 2016 21:27
Show Gist options
  • Select an option

  • Save multidis/2bbd171b188046d77ed1b017e4df9358 to your computer and use it in GitHub Desktop.

Select an option

Save multidis/2bbd171b188046d77ed1b017e4df9358 to your computer and use it in GitHub Desktop.

Revisions

  1. @agaviria agaviria revised this gist Oct 22, 2012. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions Ledger_3_commands.dat
    Original file line number Diff line number Diff line change
    @@ -12,6 +12,8 @@
    alias Dining=Expenses:Entertainment:Dining
    alias Checking=Assets:Credit Union:Joint Checking Account

    # prints budget with % target column
    ledger -f fin.dat -p "june" budget

    # Provides ledger balance until the month of "i.e. August"
    # aug could be replaced by any prefix for monthly calendar.
  2. @agaviria agaviria revised this gist Aug 11, 2012. 1 changed file with 24 additions and 0 deletions.
    24 changes: 24 additions & 0 deletions Ledger_3_commands.dat
    Original file line number Diff line number Diff line change
    @@ -53,3 +53,27 @@ ledger --code-as-payee -P reg ^Expenses @@School
    # The first example looks for any account starting with ``Bo'', of which
    # there are none. The second looks for any account with ``Bo'', which is
    @samp{Expenses:Books}.

    # If you want to know exactly how much you have spent in a particular
    # account on a particular payee, the following are equivalent:
    @smallexample
    > ledger balance Auto:Fuel and Chevron
    > ledger balance --limit "(account=~/Fuel/) & (payee=~/Chev/)"
    @end smallexample
    # @noindent will show you the amount expended on gasoline at Chevron.
    # The second example is the first example of the very power expression
    # language available to shape reports. The first example may be easier to
    # remember, but learning to use the second will open up far more
    # possibilities.

    # If you want to exclude specific accounts from the report, you can
    # exclude multiple accounts with parentheses:
    @smallexample
    ledger -s bal Expenses and not \(Expenses:Drinks or Expenses:Candy or Expenses:Gifts\)
    @end smallexample

    # A query such as the following shows all expenses since last
    # October, sorted by total:
    @example
    ledger -b "last oct" -s -S T bal ^expenses
    @end example
  3. @agaviria agaviria revised this gist Aug 11, 2012. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions Ledger_3_commands.dat
    Original file line number Diff line number Diff line change
    @@ -42,3 +42,14 @@ ledger --code-as-payee -P reg ^Expenses @@School
    $ 5,480.00
    20:39:21 ~/ledger/test/input >
    @end smallexample

    # You can use general regular expressions in nearly anyplace Ledger needs a string:
    @smallexample
    20:40:28 ~/ledger/test/input > ledger balance -f FILENAME ^Bo
    21:13:29 ~/ledger/test/input > ledger balance -f FILENAME Bo
    $ 20.00 Expenses:Books
    @end smallexample

    # The first example looks for any account starting with ``Bo'', of which
    # there are none. The second looks for any account with ``Bo'', which is
    @samp{Expenses:Books}.
  4. @agaviria agaviria revised this gist Aug 11, 2012. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions Ledger_3_commands.dat
    Original file line number Diff line number Diff line change
    @@ -30,3 +30,15 @@ ledger --code-as-payee -P reg ^Assets
    @smallexample
    ledger --code-as-payee -P reg ^Expenses @@School
    @end smallexample

    # Most times this is more than you want. Limiting the results to specific
    # accounts is as easy as entering the names of the accounts after the
    # command.
    @smallexample
    20:37:53 ~/ledger/test/input > ledger balance -f FILENAME Auto MasterCard
    $ 5,500.00 Expenses:Auto
    $ -20.00 Liabilities:MasterCard
    --------------------
    $ 5,480.00
    20:39:21 ~/ledger/test/input >
    @end smallexample
  5. @agaviria agaviria revised this gist Aug 11, 2012. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion Ledger_3_commands.dat
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,18 @@
    # comments example for .dat or .ledger files
    @smallexample

    ; This is a single line comment,
    # and this,
    % and this,
    | and this,
    * and this.

    # If you have a deeply nested tree of accounts,
    # it may be convenient to define an alias, for example:
    @smallexample
    alias Dining=Expenses:Entertainment:Dining
    alias Checking=Assets:Credit Union:Joint Checking Account


    # Provides ledger balance until the month of "i.e. August"
    # aug could be replaced by any prefix for monthly calendar.
    # ledger bal -f YOURFILENAME --period "until aug"
  6. @agaviria agaviria renamed this gist Aug 11, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  7. @agaviria agaviria revised this gist Aug 11, 2012. 1 changed file with 14 additions and 6 deletions.
    20 changes: 14 additions & 6 deletions Ledger 3 commands
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,25 @@
    // Provides ledger balance until the month of "i.e. August"
    // aug could be replaced by any prefix for monthly calendar.
    ledger bal -f YOURFILENAME --period "until aug"
    @smallexample

    ; This is a single line comment,
    # and this,
    % and this,
    | and this,
    * and this.

    # Provides ledger balance until the month of "i.e. August"
    # aug could be replaced by any prefix for monthly calendar.
    # ledger bal -f YOURFILENAME --period "until aug"

    // Provides a balance of account type "i.e. assets, expenses"
    # Provides a balance of account type "i.e. assets, expenses"
    ledger -f YOURFILENAME balance assets:checking
    ledger -f YOURFILENAME register expenses:food

    // See account subtotals for any postings related to a specific fund
    # See account subtotals for any postings related to a specific fund
    @smallexample
    ledger --code-as-payee -P reg ^Assets
    @end smallexample

    // Or to see a particular funds expenses, the @samp{School} fund in this case
    # Or to see a particular funds expenses, the @samp{School} fund in this case
    @smallexample
    ledger --code-as-payee -P reg ^Expenses @@School
    @end smallexample
  8. @agaviria agaviria revised this gist Aug 11, 2012. 1 changed file with 11 additions and 1 deletion.
    12 changes: 11 additions & 1 deletion Ledger 3 commands
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,14 @@ ledger bal -f YOURFILENAME --period "until aug"

    // Provides a balance of account type "i.e. assets, expenses"
    ledger -f YOURFILENAME balance assets:checking
    ledger -f YOURFILENAME register expenses:food
    ledger -f YOURFILENAME register expenses:food

    // See account subtotals for any postings related to a specific fund
    @smallexample
    ledger --code-as-payee -P reg ^Assets
    @end smallexample

    // Or to see a particular funds expenses, the @samp{School} fund in this case
    @smallexample
    ledger --code-as-payee -P reg ^Expenses @@School
    @end smallexample
  9. @agaviria agaviria revised this gist Aug 11, 2012. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion Ledger 3 commands
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    // Provides ledger balance until the month of "i.e. August"
    // aug could be replaced by any prefix for monthly calendar.
    ledger bal -f YOURFILENAME --period "until aug"
    ledger bal -f YOURFILENAME --period "until aug"

    // Provides a balance of account type "i.e. assets, expenses"
    ledger -f YOURFILENAME balance assets:checking
    ledger -f YOURFILENAME register expenses:food
  10. @agaviria agaviria created this gist Aug 10, 2012.
    3 changes: 3 additions & 0 deletions Ledger 3 commands
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    // Provides ledger balance until the month of "i.e. August"
    // aug could be replaced by any prefix for monthly calendar.
    ledger bal -f YOURFILENAME --period "until aug"