I use find
to get the path to my directory and I want to use sed
to redact ALL the files under the directory that have been modified more than n days
I run this:
find "$path" -type f -mtime +$days -exec sed -i.bak -E -f redact.sed {} \;
.
$path
: path to current directory.
$days
number of days since lost modified.
What is wrong with this? More specifically, I don't know what to put after redact.sed
to get it to run all files under the directory.
sed -i.bak -E -f redact.sed redact.sed
- running the sed script on itself could be a problem. – rowboat Sep 29 '20 at 03:26redact.sed
twice? – bull Sep 29 '20 at 03:49$path
and$days
? Btw,$path
is an unfortunate name for a variable, as it can be easily confused with$PATH
. – rexkogitans Sep 29 '20 at 06:28$days
is 2 and$path
to be user/file/redact – bull Sep 29 '20 at 06:53