« »

A Few Good Lines

For my first assignment in Programming A to Z, I wrote a command line script that searched the text of Aaron Sorkin’s screenplay A Few Good Men for occurrences of the word “truth” and then sorted the resulting lines alphabetically by the fourth word (to bolster the appearance of serendipitous poetic randomness and to ensure that lines shorter than four words—possible titles—appeared at the top) and eliminated any duplicate lines.

Applying the following to the screenplay:

grep "truth" -i <afgm.txt | sort -fd -k 4 | uniq >sorted.txt

produced:

the truth.
we’d all just as soon hear the truth.
I can to bring the truth to light.
truth, and nothing but the truth so help
And the truth is this: your son is dead
That’s a distortion of the truth. Private
night. Jessep was telling the truth. The
You can’t handle the truth!
You don’t want the truth. Because deep
You can tell the truth, corporal, it’s
Court-Martial will be the truth, the whole
I want the truth.
searching for the truth.
Ain’t that the truth. Catch you tomorrow.

Sorting by the second word instead of the fourth:

grep "truth" -i <afgm.txt | sort -fd -k 2 | uniq >sorted.txt

produced this poignant meditation on epistemology and the search for meaning:

That’s a distortion of the truth. Private
we’d all just as soon hear the truth.
truth, and nothing but the truth so help
You can tell the truth, corporal, it’s
I can to bring the truth to light.
You can’t handle the truth!
You don’t want the truth. Because deep
searching for the truth.
night. Jessep was telling the truth. Tne
Ain’t that the truth. Catch you tomorrow.
And the truth is this: your son is dead
the truth.
I want the truth.
Court-Martial will be the truth, the whole

I also ran this slightly modified version to similarly search for “code red”:

grep "code red" -i <afgm.txt | sort -fd | uniq >red.txt

The result captures not only the intensity of the film but also the sometimes comedically repetitive rigamarole of a legal system based on hearsay before ending with an unfinished accusation that alludes to the undercurrent of guilt, the symbolic “blood on our hands” that underpins the Judeo-Christian West. Good work Aaron Sorkin.

6th, receive a code red?
A code red was ordered by my platoon
about code reds? On the record I tell you
code red…
considered a code red?
Did Kendrick order the code red?
Did you order the code red?
discusses code reds.
Do you know what a code red is?
give Santiago a code red.
give Santiago a code red?
Have you ever ordered a code red?
Have you ever received a code red?
is to perform code reds?
Jessep told Kendrick to order a code red.
Kendrick ordered the code red, didn’t he?
marine would get a code red?
My point is that I think code reds still
ordered the code red.
sounded an awful lot like a code red.
the term code red and its definition in
to give Santiago a code red?
told them to give him a code red.
Was it a code red?
Willy Santiaga code red?
with code reds, please.
You got a code red ’cause your palms were

Comments

Comments are closed.