Back to labs/answer key page

tgrep '/^V/ < /^rac[ei]/' | more

Here is a quick breakdown of the different parts of that query. First, no corpus is specified, since I'm assuming you've got TGREP_CORPUS set to the corpus you want to work with. If you don't, and you try this, tgrep will just wait for you type out the corpus in standard in. So hit Ctrl-C, set the value of TGREP_CORPUS and start again.

The single quotes around the search pattern are there to protect the pattern from being interpreted by the shell (for example, < is an input redirect symbol for the shell, but since it is protected by the single quotes, it gets passed to tgrep for interpretation instead). Tgrep interprets < as immediate dominance.

Both the tag (/^V/) and the word (/^rac[ei]/) are regular expressions, which is why they are enclosed in slashes (/ /). The ^ means that the expression must match the beginning of the node name.

Back to labs/answer key page

-----

Emily M. Bender
Last modified: Fri Dec 8 12:02:02 2000