powered by
R equivalent of GNU-sed
stream_editor(raw_lines, pattern, target, replacement)
raw_lines : modified vector of lines
a vector of readLines from the file
a regex pattern to match
target string to be replaced
replacement string to be substituted
example_string <- "\\target{} \\not_a_target{}" texor::stream_editor(example_string,"\\s*\\\\target\\{\\}", "\\\\target", "\\\\hit")
Run the code above in your browser using DataLab