Twin Peaks Usenet Archive

Subject: Re: facts to date
From: jamison@hobbes.Corp.Sun.COM (Jamison Gray)
Date: 1990-04-23, 23:38

In article <> writes:
> >   MEMO TO:  FBI Special Agent Dale Cooper
> >   RE:  Twin Peaks case to date
> >
> >   Here are the developemnts to date in the "Twin Peaks" case.  I have
> >   placed them in relational database format, as usual.  I would have done
> >   more, but Albert has been a pain.  You know how that is.  

Great database, "Diane"!  I've found it very useful, since I missed
the first two episodes.  I hope you find the time to keep it
up to date as the show progresses...

I've taken the opportunity of an interesting database to play
with "awk" a bit, and I hacked up the following two scripts
which helped me out.  I'm an awk novice, so they're worth
about what you're paying for them...

1) Somewhere along the line, the lines of the databases got wrapped,
so that Diane's "sed" scripts wouldn't work correctly.  I wrote
the first script below, "tp-joinlines", to join the events file
back into one-record-per-line (I massaged the groups database manually;
it only needed it in a couple places, and my script didn't work on it). 

	chmod a+x tp-joinlines
	tp-joinlines events2
	mv events2 events 

2) I kept wanting to look up everything known about a person
while I was going through the events of the story, so I worked
up "tp_who".  Just supply it with the nickname of the character,
as supplied in the events data.  It prints out the record
from the people database, and any relationships from the groups 

(In case anyone on a Unix system didn't know how to use
the Diane database, the following worked for me:
1 - cut the directed part out of the article, save it in a file, e.g. "tp"
2 - sh tp
3 - chmod a+x Events People
4 - If some of the records in "events" or "people" are wrapped onto
    multiple lines, fix them so each is on a single line (by editing,
    or by using my tp-joinlines on "events")
5 - Events event.list
6 - People people.list)

----------- cut here for tp-joinlines -----------
#!/bin/awk -f
# join Twin Peaks event database lines that have been broken up by mailer
# (we hope they haven't been broken right before a ":")
# method is: print lines with carriage return at beginning instead
# of end, omitting the CR if it doesn't start with a colon.
# Doesn't work with people or groups databases: their records don't
# start with ":" like the events database.

/^#/	{ print; next } 	# leave comment lines untouched
/^:/	{ printf "\n%s", $0; next } 
	{ printf " %s", $0; next}

END	{printf "\n"}

--------------- end of tp-joinlines -------------------

------------  cut here for tp_who -------------
# print info about a Twin Peaks character, whose nickname is
# supplied on command line

# print entry from people database, using variation on Diane's script
awk -F: ' \
/^#/ {next} \
$1 == person { \
printf "Name: %s   Full Name: %s\nAge: %s   Sex: %s   Actor: %s\nDescription: %s\n", $1, $2, $3, $4, $5, $6} \
'  person=$1 people 

# print the relationships the person is involved in
echo Relationships:
grep $1 groups | awk -F: ' \
/^#/		{ next } \
$1 == "locals" 	{printf "  Inhabitant of Twin Peaks\n"; next} \
$1 == "outsiders" {printf "  Outsider to Twin Peaks\n"; next} \
		{printf "  %s:  %s (%s)\n     %s\n", $2, $3, $1, $4} \
' - 

------------------- end of tp_who ----------------------

Here's a sample:

hobbes 140 % tp_who Cooper
Name: Cooper   Full Name: Dale Cooper
Age: 35   Sex: M   Actor: Kyle McLachlan
Description: FBI Special Agent
  Outsider to Twin Peaks
  police:  possible suspect (bobby-police)
     Bobby Sheriff Cooper
  police:  suspect (james-police)
     James Sheriff Cooper
  business:   (tape-recorder)
     Cooper Diane
  business:  people investigating the murders (fbi)
     Cooper Albert

Here's to better TV viewing through the miracle of computer automation.
Pretty soon, we won't have to watch at all... 

					-- Jamie Gray

Jamie Gray, Sun Microsystems    "Broken pipes; broken tools;
Mountain View, CA                People bendin' broken rules"
Internet:  jamison@Sun.COM            - Bob Dylan, "Everything's Broken"

Jamie Gray, Sun Microsystems    "Broken pipes; broken tools;
Mountain View, CA                People bendin' broken rules"
Internet:  jamison@Sun.COM            - Bob Dylan, "Everything's Broken"