hacker

Tricks and Convenience functions for GNU R
Log | Files | Refs

commit 84b220b071939e1a140698f74016456adcac259e
parent f718a851fd433e21e03a403ea254a42910ee1ffb
Author: JayVii <jayvii@posteo.de>
Date:   Wed,  2 Sep 2020 14:04:04 +0200

multiple expressions possible

Diffstat:
Msub_preload.R | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sub_preload.R b/sub_preload.R @@ -34,10 +34,13 @@ sub_preload <- function(pattern, replacement, file, backup = TRUE, # Construct additional parameters if (backup) ipost <- "=.BAK" if (extended) eext <- "-E" - args <- paste0("--in-place", ipost, " ", eext, " ", "-e") + args <- paste0("--in-place", ipost, " ", eext) + + # construct script sequence + sseq <- paste0("-e ", "'", script, "'") # run sed - system2(command = "sed", args = paste(args, script, file), stdout = "") + system2(command = "sed", args = paste(args, seq, file), stdout = "") } # EOF sub_preload.R