- I have a directory with multiple subdirectories, wherein each contain multiple files.
- Many files contain the sentence "these are all my pencils.".
- I want to replace all occurrences of that sentence with "my pens are the following, ok."
How do I do that effectively from within the parent directory in question?
Examples of my attempts:
1] find <mydir> -type f -exec sed -i 's/these are all my pencils/my pens are the following, ok/g' {} +
2] find . -type f -not -path '*/\.*' -exec sed -i 's/these are all my pencils/my pens are the following, ok/g' {} +
I don't know why this reference isn't working.
None of the attempts effected any changes. Attempt 1]
complained about "command c expects \ followed by text". Attempt 2]
complained against "invalid command code .". I tried many of the others to no avail as well. (I can't list all of them.)