Bird
0
0

You want to find how many lines in server.log contain the word timeout ignoring case, and display only the count. Which command should you use?

hard📝 Application Q15 of 15
Linux CLI - Text Processing
You want to find how many lines in server.log contain the word timeout ignoring case, and display only the count. Which command should you use?
Agrep -i -c timeout server.log
Bgrep -i timeout server.log
Cgrep timeout -i -c server.log
Dgrep -c timeout server.log
Step-by-Step Solution
Solution:
  1. Step 1: Identify options needed

    You need to ignore case (-i) and count matching lines (-c).
  2. Step 2: Check correct option order

    Options can be combined as -i -c or -c -i. grep -i -c timeout server.log uses both correctly before pattern and file.
  3. Step 3: Analyze other options

    grep -c timeout server.log lacks case insensitivity. grep -i timeout server.log shows matches but not count. grep timeout -i -c server.log has incorrect argument order (pattern before options).
  4. Final Answer:

    grep -i -c timeout server.log -> Option A
  5. Quick Check:

    Use -i and -c together for case-insensitive count [OK]
Quick Trick: Combine -i and -c to count ignoring case [OK]
Common Mistakes:
  • Omitting -i for case-insensitive search
  • Using pattern before options causing errors
  • Expecting output lines instead of count

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes