Reputation: 102296
I'm using sed and grep to search and replace boost::shared_ptr with std::shared_ptr. How do I keep egrep
out of .svn
. Its leading to local corruptions:
Transmitting file data .svn: E155017: Commit failed (details follow):
svn: E155017: Working copy text base is corrupt
svn: E200014: Checksum mismatch for text base of '/home/jeffrey/owasp-esapi-cplusplus/doc/html/_codec_8cpp_source.html':
expected: 09ead67f10a06a392ec41455179da560
actual: 310ceca1a9c721b40db494f62854d2df
Jeff
Upvotes: 1
Views: 535
Reputation: 74048
Try find
with xargs
find /path/to/basedir -name .svn -prune -o -iname '*.h' -print0 , -iname '*.cpp' -print0 | xargs -0 sed -i 's/boost::shared_ptr/std::shared_ptr/g'
Upvotes: 2
Reputation: 185189
I recommend you to use ack instead of grep
to search files. It takes the same basic options as grep
.
It will skip .svn
, .git
... dirs & binaries by default.
Example :
ack -rl --print0 "pattern" . | xargs -0 -l sed -i 's/pattern/other_pattern/g'
So finally :
ack -rl --print0 "boost::shared_ptr" . |
xargs -0 -l sed -i 's/boost::shared_ptr/std::shared_ptr/g'
Upvotes: 4