Which bash command will print all lines from the `colors.txt` file containing the non case-sensitive pattern `Yellow`?
Which bash command will print all lines from the `colors.txt` file containing the non case-sensitive pattern `Yellow`?
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.
A is correct grep -i “yellow” colors.txt
locate -i Yellow colors.txt
locate is for file search. grep is for content search within a file.
This was easy to test. A is correct.
grep is for looking inside files