Which of the following commands changes all occurrences of the word ''bob'' in file data to ''Bob'' and prints the result to standard output?
Suggested Answer: B
Get Premium 101-500 Questions
as Interactive Web-Based Practice Test or PDF
Real Exam Format
Detailed Explanations
Instant Access
Get Your Practice Test
14 comments · newest first
NO
Noah
10 months ago
C looks tempting, but it won't replace all occurrences.
FR
Freeman
10 months ago
I thought it was A at first, but B makes more sense.
EL
Elbert
10 months ago
Definitely agree, B is the way to go.
LE
Lezlie
10 months ago
Option B is the correct one!
JE
Jesus
10 months ago
Wait, why does B have a 'g'? Is that really necessary?
VI
Virgie
11 months ago
I thought the command needed to end with a 'g' for it to change all occurrences, but I can't recall if that's in option B or not.
AN
Anglea
11 months ago
I practiced a similar question, and I feel like the correct answer should have the 's' and 'g' together. So, B seems right to me.
CH
Chau
11 months ago
I'm not entirely sure, but I remember something about using slashes in sed commands. Was it option A?
ST
Stephanie
11 months ago
I think the command needs to include a 'g' for global replacement, so maybe it's option B?
VA
Valentin
12 months ago
I think the answer is B. The 's/bob/Bob/g' syntax looks right to me for replacing all instances of 'bob' with 'Bob' in the file 'data'.
TY
Ty
12 months ago
I'm a bit unsure about this one. I know sed is powerful for text processing, but I'm not super familiar with the different syntax options. I'll have to review my notes before deciding.
SI
Simona
12 months ago
The key here is the 'g' flag in the sed command, which stands for 'global' and ensures all occurrences are replaced, not just the first one. I'd go with B.
LO
Loreen
1 year ago
Hmm, I'm a bit confused on this one. I know sed is used for text manipulation, but I'm not totally sure about the specific syntax. I'll have to think this through carefully.
OL
Oliva
1 year ago
I'm pretty sure the answer is B. The 's/bob/Bob/g' syntax in sed is used to replace all occurrences of 'bob' with 'Bob'.