LPI
101-350 · Question #88
Which of the following sed commands will replace all instances of the string foo with the string foobar changing the file file1.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 file1.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
(64 responses)- A3% (2)
- B2% (1)
- C9% (6)
- D83% (53)
- E3% (2)
Community Discussion
No community discussion yet for this question.