Learn R Programming

grepreaper (version 0.1.0)

build_grep_cmd: Build grep command string

Description

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.

Usage

build_grep_cmd(pattern, files, options = "", fixed = FALSE)

Value

A properly formatted command string ready for system execution.

Arguments

pattern

Character vector of patterns to search for.

files

Character vector of file paths to search in.

options

Character string containing grep flags (e.g., "-i", "-v").

fixed

Logical; if TRUE, grep is told to treat patterns as fixed strings.