Answer for KodeKloud Question - Linux String Substitute

 The backup server in the Stratos DC contains several template XML files used by the Nautilus application. However, these template XML files must be populated with valid data before they can be used. One of the daily tasks of a system admin working in the xFusionCorp industries is to apply string and file manipulation commands!

Replace all occurrences of the string Sample to Cloud on the XML file /root/nautilus.xml located in the backup server.

Sample Answer: 

#ssh to server

    ssh <user>@<server>

#switch to root user

    sudo su

# verify 

    cat nautilus.xml | grep -i Sample 

#Replace command

    sed -i 's/Sample/Cloud/g' /root/nautilus.xml

#you can verify again using the below command 

    cat nautilus.xml | grep -i Sample 
 

Note: **The Question copied it for learning purposes.** Commands are correct but based on your question the server, user name, and other details might differ, so please do check.

check the below video too for how to do a similar task (i have done a sample task on Ubuntu OS)



No comments:

Post a Comment

Featured Post

Answer for Kodekloud DEVOPS Questions - Init container in Kubernetes

Question: 1. Create a Deployment named as ic-deploy-devops. 2. Configure spec as replicas should be 1 , labels app should be ic-devops , ...