Music 824: Computer Applications in Music Research
Ohio State University
School of Music

Humdrum Exercise #9

For this exercise you will need to know the following new commands:

UNIX Commands Humdrum Commands

Change directories to /var/share/Humdrum/Music824/misc/ and answer the following questions. For each question, identify the command(s) used, and (when asked) the answer.

  1. Which file contains the string `4g' in a comment?
    COMMAND:   grep '!.*4g' *
                              rid -DI * | grep '4g'
                              grep 'A Work Containing' *
    ANSWER:       unusual04
  2. Which file contains the string `OTL' in a data record?
    COMMAND:   grep -v '^[!*]' | grep 'OTL'
    ANSWER:       unusual02
  3. In the file "unusual01" use the mint command to determin how many melodic minor second intervals are present. What mistake can be easily made?
    COMMAND:   mint unusual01 | rid -GLI | grep -c 'm2'
    ANSWER:       4 (not 5)
                              Notice that the string 'm2' occurs in a comment, so rid -GLI is necessary.
  4. Create an inventory of all interpretations in the file "unusual03". Which interpretation occurs most commonly?
    COMMAND:   rid -GLD unusual03 | sort | uniq -c | sort -n
                              grep '^\*' unusual03 | sort | uniq -c | sort -n
    ANSWER:       *A (9 occurrences)
                              N.B. This presumes that the input contains only a single spine.
  5. How can one remove all the null data records in the file "unusual05"?
    COMMAND:   rid -d unusual05

Return to Exercises and Assignments Index
Return to Music 824 Index