==================
 Brinance reports
==================

   Reports? Didn't notice the option about reporting? Well, that's good because
there aren't any. The file format was designed to be simple enough so that it
wouldn't need any built-in functions for reporting. The intent is that you can
use the standard UNIX command line tools to pull whatever information you like
out of the brinance account files.
   First off, you should know about the GNU extensions to grep, particularly -A
and -B. If you're in the know, move on. You specify how many lines to display
BEFORE the match with -B, and how many lines to display AFTER with -A. So, you
can use a command line like so:

[loco@erebor]% grep -B 1 -A 1 rent ~/.brinance/account0
#200302251215
#ski rental
-103.02
--
#200304101824
#1155: renter's insurance
-50.00
--
#200305141318
#1164: Allstate: renter's insurance
-55.65
--
#200305240219
#1168: rent
-341
--
#200306210142
#1176: rent
-422.5
--
#200308011236
#1185: rent
-407.5
--
#200309012012
#1190: rent
-455.5

   Notice that this command puts an extra '--' line in between each match, but
only if they're not adjacent in the file. What we've got here is every instance
of the word "rent", along with its whole transaction (the line before and the
line after). Notice it picks up any time I entered r-e-n-t, so I also got ski
rental, renter's insurance, etc. Being a little tricky with regular expressions
could fix that though.
   Another example. I always type a check number, followed by a colon (':') to
indicate I wrote a check. Maybe I want to know some of the things I bought with
checks.. I could use this command line:

[loco@erebor]% egrep "^#[0-9]{4}:" ~/.brinance/account0
#1138: GameCube
#1139: car payment
#1140: cash
#1141: groceries
#1142: PCS bill
#1143: car insurance
#1144: automatic grokker
#1145: rent
#1146: Car insurance Allstate
#1147: Renters insurance Allstate
#1148: PCS bill
#1149: car payment
#1150: rent
#1151: gas
#1152: mother's day flowers
#1153: car payment
#1154: PCS bill
#1155: renter's insurance
#1156: car insurance
#1158: rent

   This pattern ("^#[0-9]{4}:"), if you're not familiar with regular
expressions, specifies to print any line that starts with a hash ('#'), and is
followed by exactly four digits and a colon. I had to use egrep for this pattern
to work, but it's pretty much the same.
   Anyway, these two examples are just to give you a starting point with
generating some reports with the brinance account files. Let me know what you
come up with.

