Constructs a safe and properly formatted grep command string for system execution. This function handles input sanitization by utilizing R's internal shell quoting mechanism, ensuring compatibility across different operating systems.
build_grep_cmd(pattern, files, options = "", fixed = FALSE)A properly formatted command string ready for system execution.
Character vector of patterns to search for.
Character vector of file paths to search in.
Character string containing grep flags (e.g., "-i", "-v").
Logical; if TRUE, grep is told to treat patterns as fixed strings.