Skip to content

sixela/couplebreaker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Couple Breaker

For a more generic version of money-owed calc script, you can find another script (python) at https://gist.github.com/sixela/c63fc4e324983c2a769825fe0465ce44

Purpose

Simple money-owed calculator for the end of the month. Only works for 2 persons

##Usage

  1. Just run awk --posix -f couplebreaker.awk ./myfile.tsv

Format

Input file must be field-separated with following columns: When;Who;What;HowMuch;Personnal;DirectDebt

  • Separator chosen doesn't matter. Default is "\t" but you can change it with awf's -F
  • "When" field isn't really used for now. But will be, as a filter. Format is ^[0-9]{2}.[0-9]{2}.[0-9]{2,4}
  • "Personnal" field :
    • Filled with a number: add amount into personnal expenses, and remove it from HowMuch amount
    • Filled with another character: it's a personnal purchase and shoudn't count into shared expenses
  • "DirectDebt" field means that one made a purchase (that shouldn't count for shared expenses) but for the other

##Example

$ cat ./myfile.tsv
When    Who     What    HowMuch Personnal       DirectDebt
04/11/2014      Person1 Food    40
07/11/2014      Person2 Bread   2.05
07/11/2014      Person2 Soap    10      x
07/11/2014      Person2 Beer    15              x
06/11/2014      Person1 Loto Win    +200
$
$ awk --posix -f couplebreaker.awk ./myfile.tsv
User         Incomes  Expenses Personnal    Direct     Total
----         -------  -------- ---------    ------     -----
Person1          200        40                         47.05
Person2                   2.05        10        15         0
----         -------  -------- ---------    ------     -----
Total            200     42.05        10        15     47.05

So Person1 owe 47.05 to Person2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages