Find Two or More Words on The Same Line

PowerGREP’s file sectioning feature makes it trivial to find words that occur on the same line, or in any other kind of file section.

  1. Select the files you want to search through in the File Selector.
  2. Start with a fresh action.
  3. Leave the action type as “simple search”.
  4. Enter two or more words as the search terms. Make sure to specify each word as a separate search term, by setting the search type to “delimited literal text” or “list of literal text”. If you enter two or more words as a single search term, PowerGREP will search for that exact phrase, which is not what we want now.
  5. Turn on “line by line”.
  6. Turn on the option “list only sections matching all items”. This option only appears when you’ve entered multiple search terms. It tells PowerGREP to only display matches from sections (lines, in this case) in which all the words we’re searching for can be found.
  7. Click the Preview button to run the action.

This action is available in the PowerGREP5.pgl library as “Find two or more words on the same line”.