| |
Unix Programming - Data File Metaformats - Cookie-Jar Format
Cookie-Jar Format
Cookie-jar format is used by the
fortune(1)
program for its database of random quotes. It is appropriate for
records that are just bags of unstructured text. It simply uses newline
followed by %% (or sometimes newline followed by %) as a record
separator. Example5.3 is an example section from a
file of email signature quotes:
Example5.3.A fortune file example.
"Among the many misdeeds of British rule in India, history will look
upon the Act depriving a whole nation of arms as the blackest."
-- Mohandas Gandhi, "An Autobiography", pg 446
%
The people of the various provinces are strictly forbidden to have
in their possession any swords, short swords, bows, spears, firearms,
or other types of arms. The possession of unnecessary implements
makes difficult the collection of taxes and dues and tends to foment
uprisings.
-- Toyotomi Hideyoshi, dictator of Japan, August 1588
%
"One of the ordinary modes, by which tyrants accomplish their
purposes without resistance, is, by disarming the people, and making
it an offense to keep arms."
-- Supreme Court Justice Joseph Story, 1840
It is good practice to accept whitespace after % when looking
for record delimiters. This helps cope with human editing mistakes.
It's even better practice to use %%, and ignore all text from %% to
end-of-line.
|
The cookie-jar separator was originally %%\n. I wanted
something a bit more visible than % would have been. In fact, any
stuff after the %% is treated as a comment (or at least that's how I
wrote it).
|
|
| --
Ken Arnold
|
|
Simple cookie-jar format is appropriate for pieces of
text that have no natural ordering, distinguishable structure above
word level, or search keys other than their text context.
[an error occurred while processing this directive]
|
|