src: https://www.internalpointers.com/post/linux-find-and-replace-text-multiple-files
How to replace a string of text in multiple files inside a directory. Useful if you need to mass change a string in multiple files to something else to avoid editing each individually.
Enter the directory, for example we will use "/opt/configs" which would contain many files ending in a ".config" extension.
In this example we will want to change the text "{JAVA}" in all of the files ending with a .config extension inside /opt/configs directory to "/opt/java8/bin/java"...grep -RiIl '{JAVA}' *.config | xargs sed -i 's|{JAVA}|/opt/java8/bin/java|g'
If there is no output the strings have been replaced. If there is "no input files" output, that means there were no files that needed replacing.
Nejpopulárnější
Install ownCloud on CentOS 6
We will be setting up ownCloud on a fresh CentOS 6.6 64-bit installation. ownCloud is an open...
Install PPTP / PPP Proxy Server on CentOS 6
PPTP Proxy is an easy to setup proxy server that can be used as an OpenVPN alternative, and many...
Install VNC Server and Desktop on CentOS 6
Install the desktop environment that we will use:yum groupinstall Desktop -yInstall the TigerVNC...
Setup Teamspeak 3 Server on Linux (CentOS)
If you run a gaming community, a Teamspeak 3 server is probably a popular choice for you to have...
Setup Plex Media Server on Linux CentOS 7
Looking for a home media server to stream movies, tv shows or music? Plex is a great solution....