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?
A.
sed ‘s/foo/foobar/g’ filel M | filel M
B.
sed ‘s/foo/foobar/g’ filel M
C.
seD.i ‘s/foo/foobar/g’ filel M > filel M
D.
sed ‘s/foo/foobar/g’ filel M > filel M
E.
seD.i’s/foo/foobar/g’file1.txt
Explanation:
sed called Stream Editor, usually used to search and replace the string pattern in file.
Syntax: sed ‘s/whattofind/replacewith/globally’ filename Example: sed ‘s/cat/dog/g’ test CI will replace all cat occuranee to dog fron test file.
The correct answer would be: sed -i ‘s/foo/foobar/g’ file1.txt.
What’s given above does NOT equate to that.
The ‘seD’ – <- typo