U.S. Independence Day Deal! Unlock 25% OFF Today – Limited-Time Offer - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation LFCS Exam - Topic 4 Question 106 Discussion

Which of the following commands will output all of the lines with the name Fred in upper or lower case but not the word red from the file data_file? (Choose two)
D) grep '[Ff]red' data_file and E) grep -i fred data_file
A) grep -v fred data_file
B) grep '[f]red' data_file
C) egrep fred data_file

Linux Foundation LFCS Exam - Topic 4 Question 106 Discussion

Actual exam question for Linux Foundation's LFCS exam
Question #: 106
Topic #: 4
[All LFCS Questions]

Which of the following commands will output all of the lines with the name Fred in upper or lower case but not the word red from the file data_file? (Choose two)

Show Suggested Answer Hide Answer
Suggested Answer: D, E

Contribute your Thoughts:

0/2000 characters
Robt
2 months ago
I’m leaning towards D and E too. Makes sense!
upvoted 0 times
...
Adolph
2 months ago
E handles that well.
upvoted 0 times
...
Luisa
3 months ago
B is too specific. What about the case sensitivity?
upvoted 0 times
...
Adolph
3 months ago
I prefer B and E.
upvoted 0 times
...
Carey
3 months ago
It matches both cases, Fred and fred.
upvoted 0 times
...
Amalia
3 months ago
Why D?
upvoted 0 times
...
Carey
3 months ago
I think D and E are correct.
upvoted 0 times
...
Laura
4 months ago
I thought grep -i would include "red" too, but I guess not!
upvoted 0 times
...
Celeste
4 months ago
A is definitely wrong, it excludes everything with "fred".
upvoted 0 times
...
Catina
4 months ago
Haha, good thing we don't have to worry about that 'red' word. D and E are the way to go!
upvoted 0 times
...
Rebbeca
4 months ago
D and E are the winners. Who needs to worry about that pesky 'red' word when you've got the power of grep?
upvoted 0 times
...
Fletcher
5 months ago
D and E are the way to go. Gotta love that case-insensitive grep!
upvoted 0 times
...
Shawnna
5 months ago
I think D and E are the correct answers. The -i option in grep is perfect for matching both upper and lower case.
upvoted 0 times
...
Timothy
5 months ago
D and E look good to me.
upvoted 0 times
...
Sommer
5 months ago
I'm not entirely sure, but I remember something about the -i flag making it case insensitive, so maybe option E is also right?
upvoted 0 times
...
Wendell
5 months ago
I think option D is correct because it matches both "Fred" and "fred" using the character class.
upvoted 0 times
...
Jules
5 months ago
Hmm, I'm not sure about the difference between grep and egrep here. I'll need to review the details of each option.
upvoted 0 times
...
Lyndia
6 months ago
I've got it! Options D and E should do the trick. The case-insensitive search will get all instances of "Fred", and the -v flag in option A will exclude "red".
upvoted 0 times
...
Dino
6 months ago
I'm a bit confused by the "not the word red" part. I'll need to double-check the options to make sure I don't include that.
upvoted 0 times
...
Ming
6 months ago
Wait, how does D work?
upvoted 0 times
...
Ena
6 months ago
Definitely agree with E!
upvoted 0 times
...
Billye
6 months ago
I think D and E are the right ones.
upvoted 0 times
...
Sanda
7 months ago
I’m confused about option A; it seems like it would exclude all lines with "fred," not just the word "red."
upvoted 0 times
...
Precious
7 months ago
I practiced a similar question, and I feel like option B might not work since it only matches "fred" in lowercase.
upvoted 0 times
...
Beckie
7 months ago
Okay, I think I know how to approach this. I'll need to use a case-insensitive search to get both upper and lower case "Fred".
upvoted 0 times
...
Lynsey
7 months ago
Hmm, this looks like a tricky one. I'll need to think carefully about the different options.
upvoted 0 times
Alaine
1 month ago
B is tricky, but it won't exclude "red".
upvoted 0 times
...
Margurite
1 month ago
What about B? It seems valid.
upvoted 0 times
...
Linsey
2 months ago
E is good for case insensitivity too.
upvoted 0 times
...
Chantell
2 months ago
Definitely! D captures both cases.
upvoted 0 times
...
Keneth
2 months ago
I think D and E are the best choices.
upvoted 0 times
...
...

Save Cancel