LPI
101-400 · Question #205
Which of the following sed commands will replace all instances of the string foo with the string foobar changing the file filel.txt in place?
The correct answer is D. sed -i 's/foo/foobar/g' file1.txt. See the full explanation below for the reasoning.
Question
Which of the following sed commands will replace all instances of the string foo with the string foobar changing the file filel.txt in place?
Options
- Ased 's/foo/foobar/g' file1.txt
- Bsed 's/foo/foobar/g' file1.txt > file1.txt
- Csed 's/foo/foobar/g' file1.txt | file1.txt
- Dsed -i 's/foo/foobar/g' file1.txt
- Esed -i 's/foo/foobar/g' file1.txt >file1.txt
How the community answered
(28 responses)- A4% (1)
- B11% (3)
- C4% (1)
- D79% (22)
- E4% (1)
Community Discussion
No community discussion yet for this question.