D. sed 's/bob/Bob/g' letter > newletter
Explanation:
The sed command is a stream editor used for modifying and transforming text. The s/old/new/g syntax is used in sed to substitute the first occurrence or all occurrences of "old" with "new" in a given input.
In this case, the command sed 's/bob/Bob/g' letter > newletter is the correct choice. It reads the contents of the file "letter," replaces each occurrence of "bob" (case-sensitive) with "Bob," and then redirects the output to the file "newletter."
The "g" at the end of the command is used as a flag to indicate a global replacement, meaning it replaces all occurrences of "bob" on each line of the file.
Option D is the correct command for replacing each occurrence of 'bob' with 'Bob' in the file "letter" and writing the result to the file "newletter."
Correct. student@centos ~]$ cat letter
bob
bob and john
[student@centos ~]$ sed 's/bob/Bob/g' letter > newletter
[student@centos ~]$ cat newletter
Bob
Bob and john
upvoted 1 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Strib
6 months, 4 weeks agorhylos
2 years, 6 months ago