Narrowing your search: using the results of a previous search

  1. Let's continue with the search began in the previous section. We are looking for all occurrences of the word 'did' in Adam's speech. We have already located all occurrences of 'did' in the Adam corpus, but we want to narrow this to utterances spoken by Adam. One way of doing this is to use the results of the initial search as input to a subsequent search. The first thing to do is to save the initial search results (File>Save As...).
  2. Next open the Find dialog again (Search>Find), and enter the string that you want to search for. In our example we want to search for the string *ADA, which is the code used in every line containing an utterance of Adam's. Set the "What:" menu to "Open Windows", and make sure that the results file that you just saved is the only open window. Then click on "Find All".
  3. The results of your new search will be displayed in the familiar window, with the difference that each matching line is preceded by a BBEdit icon rather than a generic file icon. Now we have a list of all of the instances of 'did' in Adam's speech (a much smaller set than the results of our initial search).
  4. Now notice what happens if you select one of the lines in the upper pane of the window. The context of the matching line is displayed, but it is not the context in which the utterance occurred. Rather it is the surrounding lines in the results file that you saved which are displayed in the lower window.
  5. If you are still concerned about the context in which Adam used 'did' (as you should be!), then the context provided by this kind of search will be inadequate for your needs. You will need to use a more powerful search method, which is outlined in the section searching for complex patterns using 'grep'.