Skip to content

Instantly share code, notes, and snippets.

@ddeveloperr
Last active November 8, 2019 18:27
Show Gist options
  • Save ddeveloperr/36ababd22b03e8b1042674f00ac9519e to your computer and use it in GitHub Desktop.
Save ddeveloperr/36ababd22b03e8b1042674f00ac9519e to your computer and use it in GitHub Desktop.
How to Find and replace any string text across the multiple files using Linux commands Grep and Sed
Finding and replacing any string text across the multiple files using Linux commands Grep and Sed
Step1: Login with sudo privileges and locate your folder:
~$ cd /your-folder
Step2:
~$ grep -rl 'Text-to-be-Replaced' /* | xargs sed -i 's/Text-to-be-Replaced/I-AM-Replaced-Text/g'
Step3: D O N E !
NOTE that changes of find and replace linux server command will not be reflected
on those files which needs an additional permission!
To change permision search google "linux+chmod".
Regards,
Kemal C.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment