From 3edd27d60ade9ccf7bc933759fc8aefd1814d07c Mon Sep 17 00:00:00 2001 From: cuqmbr Date: Fri, 19 Apr 2024 20:36:45 +0300 Subject: [PATCH] add file contents replacing script --- recursive-replace.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 recursive-replace.sh diff --git a/recursive-replace.sh b/recursive-replace.sh new file mode 100755 index 0000000..0f206f1 --- /dev/null +++ b/recursive-replace.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env sh + +PATH_TO_ROOT_DIRECTORY="${1}" +STRING_TO_BE_REPLACED="${2}" +STRING_TO_REPLACE_TO="${3}" + +find "${PATH_TO_ROOT_DIRECTORY}" -type f -print -exec perl -0777 -i -pe "s/${STRING_TO_BE_REPLACED}/${STRING_TO_REPLACE_TO}/g" {} \;