chip@hpclisp.HP.COM (Chip Chapin) (09/15/89)
Here is simple awk program I composed to help us pick out names for our soon-to-arrive baby. More details are in the comments below. Chip Chapin ------------------ cut here ----------------------- #!/bin/sh ############################################################################### # # File: babynames.sh # RCS: $Header: $ # Description: Generate combinations of names to help name your kid. # Author: Chip Chapin # Created: Thu Sep 14 10:37:34 1989 # Modified: Thu Sep 14 11:30:43 1989 (Chip Chapin) chip@hpcllcc # Language: awk # Package: N/A # Status: Experimental (Do Not Distribute) # ############################################################################### # The purpose of this package is to print out various combinations of # candidate names for your baby. You give it a list of names that you are # considering, with up to two nicknames for each if desired. The program # will then print all possible combinations of first and middle names from # the list you provided. It also prints the the nicknames that would go # with a selected first name, and "first - middle initial - last" so you # can see how a name would look in its most commonly used form. #-------------------------------------------------------------------- #Chip Chapin, HP California Language Lab (HP/CBO/NSS/CSG/DLD/LMO/CLL) #uucp: ... {allegra,decvax,ihnp4,ucbvax} !hplabs!hpda!chip # or ... uunet!hp-sde!hpda!chip #Internet: chip%hpda@hplabs.hp.com or chip%hpda@hp-sde.hp.com #HPDesk: chip (hpda) /HPUNIX/UX #USMail: MS47LZ; 19420 Homestead Ave; Cupertino, CA 95014 #Phone: 408/447-5735 Fax: 408/973-8455 HPTelnet: 1-447-5735 #-------------------------------------------------------------------- LASTNAME=Chapin # The baby's last name awk ' { names[++nc] = $1; nicknames[nc] = $2; altnicknames[nc] = $3; } END { for (i=1; i<=nc; i++) { printf "\n%s %s\n", names[i], lastname; if (nicknames[i] != "") printf "\t%s %s\n", nicknames[i], lastname; if (altnicknames[i] != "") printf "\t%s %s\n", altnicknames[i], lastname; for (j=1; j<=nc; j++) { if (j != i) { printf "\t%s %s %s\n\t%s %s. %s\n", \ names[i], names[j], lastname, \ names[i], substr(names[j],1,1), lastname; } } } } # END ' lastname=$LASTNAME - <<-EOF Drake Jesse Jess Daniel Dan William Will Bill Andrew Andy Robert Rob Bob Gregory Greg EOF # The list above is the set of names that you want to try. # The format allows for two nicknames in addition to the given name, # separated by white space. # end