findlines: Find lines in a bunch of files

View source: R/findlines.R

findlinesR Documentation

Find lines in a bunch of files

Description

Works like grep or which for a bunch of files (line by line). Useful example: 1. Always use the same predefined word(s) to mark positions in scripts where you should review something at some time (e.g. 'TODO'). 2. Search for those words within a bunch of files to get an overview.

Usage

findlines(
  expression = "# magic word",
  exclusive = FALSE,
  path = ".",
  filepattern = "\\.R$|\\.Rmd$",
  recursive = TRUE
)

Arguments

expression

Character. Specify expression to match the line.

exclusive

Logical. If TRUE use which, else grep.

path

Character. Specify path to the directory including the files.

filepattern

Character. Specify file pattern.

recursive

Logical.

Note

If exclusive == FALSE you can use regular expressions (and therefore multiple expressions at a time).

Author(s)

Frederik Sachser


sachserf/sf documentation built on June 8, 2024, 4:23 p.m.