FileUtils icon

FileUtils

File system operations utility

Search Content

AI-generated

Overview

This node operation searches for specific content within a file using a text or regular expression pattern. It is useful for scenarios where you need to find occurrences of certain text or patterns inside files, such as searching logs for error messages, scanning documents for keywords, or filtering data files for relevant entries.

Use Case Examples

  1. Search for the word 'error' in a log file to identify issues.
  2. Use a regex pattern to find all email addresses in a text file.
  3. Scan a configuration file for specific parameter settings.

Properties

Name Meaning
File Path Path to the file to search within. Required if the input source is a file path, otherwise optional for metadata.
Search Pattern The text or regex pattern to search for within the file. This is a required input.
Use Regular Expression Boolean flag indicating whether the search pattern should be treated as a regular expression.

Output

JSON

  • results - An array of search results matching the pattern found in the file.

Dependencies

  • This operation depends on the ability to read the specified file path and perform content searching, likely using system utilities or internal methods.

Troubleshooting

  • Ensure the file path is correct and accessible; otherwise, the search will fail.
  • If using a regex pattern, verify the pattern syntax to avoid errors.
  • If no results are found, confirm the search pattern matches the content format and encoding of the file.

Discussion