GURGLE Tutorial: Basic Definition File

Included below is a basic definition file to process our phone directory database. Copy it into a file in the same directory as the data source file and call it phones1.grg or directly download and save phones1.grg.

%%database "phonedir.txt"
%%define DELIM |
%%define NAMCOL

The file contains three lines. The first specifies the database source to use. The second defines the field delimiter (this line would have been unneccessary if we had used a whitespace delimited input file). The third means that the first line of the database file should be interpreted as containing the field names.

Now we need to gurgle the above file to produce the output.

gurgle phones1.grg

If everything worked this will created phones1.tex which is the output file which should look like below.

Jack|Frost|4321|A23|Air Conditioning Technician
Bill|Clinton|4723|C55|Legal Services
Jerry|Springer|8844|B44|Public Relations

Well we haven't gained much there! The default behaviour of gurgle includes a default header (taken from the names of the fields) and a default record which is just the values using the delimiter specified in the definition file. So our output in this case is identical to our input.


Try the definition file without the NAMCOL and the DELIM directive lines and observe the different behaviour. A definition file must always have at least one database line otherwise there will be an error.

Now lets actually format the output.