Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

GAQM Exam LCP-001 Topic 3 Question 60 Discussion

Actual exam question for GAQM's LCP-001 exam
Question #: 60
Topic #: 3
[All LCP-001 Questions]

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?

Show Suggested Answer Hide Answer
Suggested Answer: C, E

Contribute your Thoughts:

Dino
17 days ago
Replacing 'foo' with 'foobar'? Sounds like someone's got a case of the Mondays.
upvoted 0 times
...
Corazon
18 days ago
The question is about sed, but I'm feeling a little frazzled. Maybe I should try something more soothing, like awk.
upvoted 0 times
...
Tonette
22 days ago
Seriously, who would choose Option C? Piping the output to the file name is just nonsensical.
upvoted 0 times
...
Layla
23 days ago
I think Option B is the best choice. Redirecting the output to the same file is a surefire way to update the contents.
upvoted 0 times
...
Gerald
2 months ago
Option D is the way to go. The '-i' flag modifies the file in place, which is exactly what the question asks for.
upvoted 0 times
Goldie
15 days ago
User4: Exactly, option D is the way to go.
upvoted 0 times
...
Stephaine
21 days ago
User3: So we don't need to redirect the output to the same file.
upvoted 0 times
...
Oliva
30 days ago
User2: Yeah, the '-i' flag is used to modify the file in place.
upvoted 0 times
...
Kallie
1 months ago
User1: I think option D is the correct one.
upvoted 0 times
...
...
Estrella
2 months ago
Option A is the correct answer. It uses the 's' command to replace 'foo' with 'foobar' and the 'g' flag to replace all occurrences.
upvoted 0 times
Elina
29 days ago
User2: Thanks for clarifying, I'll go with that option.
upvoted 0 times
...
Dierdre
1 months ago
User1: I think the answer is A) sed 's/foo/foobar/g' file1.txt
upvoted 0 times
...
...
Shawna
2 months ago
I'm not sure, but I think option D makes sense because it uses -i flag for in-place editing.
upvoted 0 times
...
Georgeanna
2 months ago
I agree with Larae, using -i option will change the file in place.
upvoted 0 times
...
Larae
2 months ago
I think the answer is D.
upvoted 0 times
...

Save Cancel