Reputation: 633
I want to find replace a patter1 into pattern2 only in certain files of my subdirectories. But exclude some subdirectories with replacement. What is wrong with this command?
find ./ -type f --exclude-dir='workspace' --exclude-dir='builds' \
-exec sed -i '' 's/foo/bar/g' {} \;
Upvotes: 0
Views: 156
Reputation: 241858
I don't see the option --exclude-dir
in man find
(I do in man grep
, but you can't just borrow other command's options).
Try
find . -type f -not -path './workspace*' ...
Upvotes: 2