This is the default operation. It just copies the data from the input to the output. This is usually used to translate between database formats.
This operator takes a many to many relationship and translates it to a one to many database.
For example:
a 1 a 2 a 3 b 4 b 5would translate to:
a 1 2 3 b 4 5
This is the reverse of join. It takes a database with a unique key and one or more values and translates it into a single key/value pair for each of the values.
The diff operator only works if there is a unique key. Otherwise, it has no basis for comparison. If this cramps your style, perhaps you wish to do a diffc on the product of two joins.
The output of diff is a series of key/value sets describing the difference between the i database and the c database with the removes and adds designated by '<' and '>' respectively, and the data position amonst the delimiters corresponding to the actual position of the changed data. For example, the given i:
a 1 2 3 b 4 5 6and c:
a 3 2 1 b 4 5 7the result would be o:
< a 1 3 > a 3 1 < b 6 > b 7.
This is the same as diff except it ignores the position of the value and the removes and adds are designated by '{' and '}' respectively. Therefor:
a 1 2 3is the same as
a 3 2 1and given i:
a 1 2 3 b 4 5 6and c:
a 3 2 1 b 4 5 7the result would be o:
} b 6 { b 7.
This reads diffs and diffcs and applies them to the input database.
ddb converts/compares data from/to gdbm, SQL (through a DBI interface), and flat text file. Here is an example usage that creates and plays with a gdbm file with the keys (a,b,c):
./ddb.pl ofg=a.gdbm odelim=':' idelim=' ' a 1 2 3 b 4 5 6 c 7 8 9 ^D
./ddb.pl ifg=a.gdbm idelim=' ' odelim=' ' b 4:5:6 a 1:2:3 c 7:8:9 ^D
./ddb.pl idelim=' ' cfg=a.gdbm cdelim=':' op=diff odelim=' ' a 3 2 1 b 4 5 6 c 7 8 0 ^D < a 3 1 > a 1 3 < c 0 > c 9
./ddb.pl idelim=' ' cfg=a.gdbm cdelim=':' op=diffc odelim=' ' a 3 2 1 b 4 5 6 c 7 8 0 ^D { c 0 } c 9