Bird
0
0

Given a file data.txt with the following content:

medium📝 Command Output Q13 of 15
Linux CLI - Text Processing
Given a file data.txt with the following content:
apple
banana
Apple
BANANA
apple pie
banana split

What is the output of the command grep -i 'apple' data.txt?
Aapple apple pie
BApple BANANA banana split
Capple pie banana split
Dapple Apple apple pie
Step-by-Step Solution
Solution:
  1. Step 1: Understand -i option

    The -i option makes grep case-insensitive, so it matches 'apple' and 'Apple'.
  2. Step 2: Identify matching lines

    Lines containing 'apple' ignoring case are: 'apple', 'Apple', and 'apple pie'.
  3. Final Answer:

    apple Apple apple pie -> Option D
  4. Quick Check:

    grep -i matches apple and Apple [OK]
Quick Trick: Use -i to ignore case when searching text [OK]
Common Mistakes:
  • Ignoring case sensitivity without -i
  • Missing lines with partial matches like 'apple pie'
  • Confusing output order

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes