XK0-005 · Question #875
XK0-005 Question #875: Real Exam Question with Answer & Explanation
The correct answer is C: sed -i 's/10.115.6.5/10.116.6.5/g' /etc/app.cfg. The sed (Stream Editor) command is commonly used for text replacement in files. -i - Edits the file in place (modifies /etc/app.cfg directly). s/old/new/g - Replaces all occurrences (g = globally) of 10.115.6.5 with 10.116.6.5. /etc/app.cfg - Specifies the file to modify.
Question
A server's IP address has been changed from 10.115.6.5 to 10.116.6.5. Because of this change, the application server needs to be reconfigured. Which of the following commands will allow the systems engineer to change the IP address in the /etc/app.cfg file quickly?
Options
- Aawk '{rep(/10.115.6.5/"10.116.6.5")}" /etc/app.cfg
- Bperl -i 's/10.115.6.5/10.116.6.5/g" /etc/app.cfg
- Csed -i 's/10.115.6.5/10.116.6.5/g' /etc/app.cfg
- Dpython -c "import sys;print file.replace('10.115.6.5','10.116.6.5')" <
Explanation
The sed (Stream Editor) command is commonly used for text replacement in files. -i - Edits the file in place (modifies /etc/app.cfg directly). s/old/new/g - Replaces all occurrences (g = globally) of 10.115.6.5 with 10.116.6.5. /etc/app.cfg - Specifies the file to modify.
Topics
Community Discussion
No community discussion yet for this question.