CompTIA
XK0-004 · Question #163
Using which of the following control mode commands is the correct way to substitute all occurrences of /dev/sdc with /dev/sdd while editing a file in vi?
The correct answer is D. :%s/\/dev\/sdc/\/dev\/sdd. ALL occurences..so whole file then :%s not just :s.
System Management
Question
Using which of the following control mode commands is the correct way to substitute all occurrences of /dev/sdc with /dev/sdd while editing a file in vi?
Options
- A:s//dev/sdc//dev/sdd
- B:s//dev/sdc//dev/sdd/g
- C:s//dev/sdc//dev/sdd
- D:%s//dev/sdc//dev/sdd
How the community answered
(55 responses)- A5% (3)
- B2% (1)
- C2% (1)
- D91% (50)
Explanation
ALL occurences..so whole file then :%s not just :s.
Topics
#vi editor#regex substitution#global replace#special character escaping
Community Discussion
No community discussion yet for this question.