How to search multiple terms?

0101

To search for multiple terms in a file using the less command, you can use a regular expression. Here's how to do it:

  1. Open the file with less:

    less filename.txt
  2. To search for multiple terms, type / followed by the regular expression. For example, to search for the terms "ERROR" or "WARNING", you can use:

    /(ERROR|WARNING)
  3. Press Enter to execute the search.

  4. Use n to navigate to the next occurrence and N to go to the previous occurrence.

  5. Exit less by pressing q when you're done.

This method allows you to search for any of the specified terms within the file.

0 Comments

no data
Be the first to share your comment!