i am trying to build a Bash file.
one of the commands is:
sudo vi /opt/kibana/config/kibana.yml
How can i change Automaticaly this text line :
server.host: "0.0.0.0"
with this text line:
server.host: "localhost"
tnx
Andrey
you can search and replace text from within the vi text editor using the following command
:%s/0.0.0.0/localhost/
Beware, untested!
sed -ri .bak '/server.host:/s/: *"[^"]*"/: "localhost"/' /opt/kibana/config/kibana.yml
To test it run it without -i .bak
and the change is output on stdout instead of changing the file. -i .bak
causes in-place editing and the creation of a backup file.