Thursday, November 5, 2020

Search and Replace in file using sed

Search text within one file and replace it.
sed -i 's/old_text/new_text/g' file.txt
Search text in all files in directory and replace it.

find . -type f -exec sed -i.bak 's/old_text/new_text/g' {} \;

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.