search & replace in matching files
reoccurring task:
- replace every occurence of
FOOwithBAR -
only in
*.hand*.cppfilesag -G "\.(h|cpp)" FOO -l | xargs sed -i 's/FOO/BAR/g'
In this command I use ag -- the silversearcher
-
ag -Gallows you to narrow the search to certain file types -
-lwill cause ag to only list files that contain the pattern
Written by Oliver Mueller
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Sed
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#