Skip to main content

Lab 011: Linux String Substitute


Lab 011: Linux String Substitute

Requirements

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 occurances of the string String to LUSV on the XML file /root/nautilus.xml located in the backup server.


Note

This lab focuses on Linux String Substitute configuration and management.

Prerequisites

  • SSH access to the target server with root or sudo privileges.
  • Required utilities and packages available.

Steps

Login to the backup server and switch to root. For the server credentials, check out the Project Nautilus documentation.

sshpass -p '*******' ssh -o StrictHostKeyChecking=no clint@172.16.238.16
sudo su -
*******
root@stbkp01 ~]# ls -l /root/nautilus.xml
-rw-r--r-- 1 root root 24091 Jul 26 17:23 /root/nautilus.xml
[root@stbkp01 ~]#
[root@stbkp01 ~]# grep -e String /root/nautilus.xml | wc -l
66
[root@stbkp01 ~]# sed -i 's#String#LUSV#g' /root/nautilus.xml
[root@stbkp01 ~]#
[root@stbkp01 ~]# grep -e String /root/nautilus.xml | wc -l
0
[root@stbkp01 ~]# grep -e LUSV /root/nautilus.xml | wc -l
66

Verification

  • Confirm changes applied successfully.
  • Verify configuration with appropriate show/list commands.
  • Test functionality if applicable.

Resources