Im trying to use -exec to invoke a sed statement below:

find '$path' -mtime +$daysold -exec sed -E -f redact.sed file.txt {} \;.
what does {} do? and what goes inside {}?

  • As the fine manual tells you, find will put the found filename where it sees {}. Not clear if you want the file.txt in your command but it is not definitely wrong.
    – icarus
    Sep 28, 2020 at 19:18

1 Answer 1


it should be find "$path" -mtime +$daysold -exec sed -E -f redact.sed file.txt \;

and put $path in " " instead of the ' ', also remove the braces

  • 1
    This will execute sed -E -f redact.sed on the same file.txt once for each matching file found - while syntactically valid, it's hard to see a practical reason to do that Sep 28, 2020 at 19:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.