CBRCOR Exam QuestionsBrowse all questions from this exam

CBRCOR Exam - Question 125


Which bash command will print all lines from the `colors.txt` file containing the non case-sensitive pattern `Yellow`?

Show Answer
Correct Answer: A

The correct command to search for lines containing the pattern 'Yellow' in a case-insensitive manner in the `colors.txt` file is `grep -i 'Yellow' colors.txt`. The `-i` flag enables case-insensitive matching, ensuring that lines containing 'yellow', 'Yellow', or any other case variation are matched. The `locate` command is used to search for files by name, not for searching content within files.

Discussion

4 comments
Sign in to comment
maxson69
Jun 9, 2023

A is correct grep -i “yellow” colors.txt

Bobster02Option: C
Jun 1, 2023

locate -i Yellow colors.txt

jay_c_an
Sep 19, 2024

locate is for file search. grep is for content search within a file.

BobCoolio
Aug 25, 2023

This was easy to test. A is correct.

27ea763Option: A
Jan 23, 2025

grep is for looking inside files