nerdexam
LPI

101-500 · 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. You've hit your Sonnet limit · resets Jun 8, 9am (UTC)

GNU and Unix Commands

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

(22 responses)
  • A
    9% (2)
  • C
    5% (1)
  • D
    86% (19)

Explanation

You've hit your Sonnet limit · resets Jun 8, 9am (UTC)

Topics

#sed in-place editing#text substitution#stream editor#file redirection

Community Discussion

No community discussion yet for this question.

Full 101-500 Practice