Question 280
The log might contain warning, WARNING or Warning and all variants must be found. One student proposes Run grep -i 'warning' service.log and another proposes Run status_command through the pipe operator into grep 'active'. Which technical comparison is the soundest?
Explanation
Correct Answer
Correct distinction: Run grep -i 'warning' service.log targets case insensitive search; The -i flag makes grep ignore letter case when matching. The compared alternative instead serves pipeline matching output.
Incorrect Answers
Incorrect mapping: Run status_command through the pipe operator into grep 'active' is used for pipeline matching output. It does not displace Run grep -i 'warning' service.log for the described requirement.
The mechanisms are different: The -i flag makes grep ignore letter case when matching. By contrast, The pipe sends standard output of the first command to grep for filtering. They are not universally interchangeable.
The third option addresses overwrite output redirection: The > operator redirects standard output and truncates the target before writing. The original action remains relevant because The -i flag makes grep ignore letter case when matching.