Bits of writing geekery... I was rooting around old drafts of The Unraveling today (which is still making the rounds; I am sprucing it up a bit further because reasons), and happened upon a lovely bit of cat-vacuuming: a Perl script to pull out, and highlight, every instance of a time-word in the text. I guess I was realizing that the various references to mealtimes and mornings and afternoons didn't add up, and wondering over how many actual days the principal action of the novel took place. And once you have a hundred-thousand-word blob of text, it's harder than you might think to answer such continuity questions for yourself. This probably took twenty minutes to write and, I vaguely recall, actually proved pretty useful. Here it is in all its hairy, undocumented, unrefactored glory, radiating shameless geekitude. Posted by benrosen at September 6, 2017 12:51 AM | Up to blog#!/usr/bin/perl my @words = ("kitchen", "dining", "breakfast", "lunch", "dinner", "supper", "morning", "afternoon", "evening"); system ("echo > word.usages"); foreach my $w (@words) { my $cmd = "grep -ni '$w' >> word.usages"; print "about to do: $cmd \n"; system($cmd); print "processed $w\n"; } open (IN, '< word.usages') or die 'could not open word.usages'; open OUT, '> word.usages.out'; while ( Comments
|