PrepAway - Latest Free Exam Questions & Answers

Which of the following sed commands will replace all instances of the string foo with the string foobar changi

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?

PrepAway - Latest Free Exam Questions & Answers

A.
sed ‘s/foo/foobar/g’ filel M

B.
sed ‘s/foo/foobar/g’ filel M > filel M

C.
sed ‘s/foo/foobar/g’ filel M | filel M

D.
seD.i’s/foo/foobar/g’file1.txt

E.
seD.i ‘s/foo/foobar/g’ filel M > filel M

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.

One Comment on “Which of the following sed commands will replace all instances of the string foo with the string foobar changi


Leave a Reply