sed -i 's/search/replacement/' *.txt
This will replace all the word "search" with "replacement" in all files that ended with txt.
But what if you want to replace the word "search" with "replace/ment". You just need to do minor adjustment as follow:
sed -i "s|search|replace/ment|" *.txt
Usually I omit the "-i" first to see the changes on the screen to make sure that the text are replaced properly before adding "-i" to perform the actual changes.
Until next time!!!
No comments:
Post a Comment