Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam LFCS topic 1 question 66 discussion

Actual exam question from Linux Foundation's LFCS
Question #: 66
Topic #: 1
[All LFCS Questions]

Which grep command will print only the lines that do not end with a / in the file foo?

  • A. grep '/$' foo
  • B. grep '/#' foo
  • C. grep -v '/$' foo
  • D. grep -v '/#' foo
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
rona962
1 year ago
Selected Answer: C
The grep command that will print only the lines that do not end with a / in the file foo is: C. grep -v '/$' foo Explanation: The option "-v" is used to invert the match, i.e., print lines that do not match the pattern. The pattern is '/$' which matches lines ending with a /. Therefore, "-v '/$'" matches lines that do not end with a /. Option A matches lines that end with a /, which is the opposite of what is requested. Option B matches lines that end with "/#" which is not relevant to the requested pattern. Option D matches lines that contain "/#" which is also not relevant to the requested pattern.
upvoted 1 times
...
rhylos
2 years, 9 months ago
correct. Tested it
upvoted 1 times
...
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.

SaveCancel
Loading ...