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.
- Select the files you want to search through in the File Selector.
- Start with a fresh action.
- Leave the action type as “simple search”.
- 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.
- Turn on “line by line”.
- 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.
- 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”.