Find Replace String with Sed

Dealing with copying file and modify it's content replacing strings over and over again? Some of us uses the approach of editing files using vim then executes find and replace command.

Find and replace command on vim

:s/OLD_STRING/NEW_STRING/g


But if you are already aware of the content of the file that your going to copy and just want to simply replicate it with modified context, then you may use sed.

Replicate file using sed with find replace string

[root@linux]$ sed 's/OLD_STRING/NEW_STRING/g' README.txt > README_v2.txt

Comments

Popular posts from this blog

Remote Deployment with Ant and Rsync

Site Performance Enhancement