Which command would replace "bob" with "Bob" in all instances and generate a new letter for printing?

You have created a really long letter and after you are done you notice that you used the name
“Bob” many times but you forgot to capitalize it in many instances. Which command would replace
“bob” with “Bob” in all instances and generate a new letter for printing?

You have created a really long letter and after you are done you notice that you used the name
“Bob” many times but you forgot to capitalize it in many instances. Which command would replace
“bob” with “Bob” in all instances and generate a new letter for printing?

A.
sed ‘/bob/Bob’ letter >newletter

B.
sed s/bob/Bob/letter < newletter

C.
sed ‘s/bob/Bob’ letter > newletter

D.
sed ‘s/bob/Bob/g’ letter > newletter

E.
sed ‘s/bob. Bob/’ letter > newletter

Explanation:
sed is called the stream editor command, which is used to find and replace the string pattern.
Example:
# sed ‘s /cat/dog/’ testfile >testfilel: Which replace the cat to dog from testfile and redirect the
output into testfi lei file.
Similaly Answer C is correct.



Leave a Reply 2

Your email address will not be published. Required fields are marked *


zac

zac

The only correct choice is Answer D. Please do not mislead test takers.

While the example given
sed ‘s /cat/dog/’ testfile >testfilel

will work in theory, practically without g options, it will substitute for every occurrence of the word. At the very best it will substitute for the first occurrence in every line.

zac

zac

I meant to say without the g option it will NOT replace every word