Bird
0
0

Identify the error in this command: sed s/apple/orange/g file.txt

medium📝 Debug Q6 of 15
Linux CLI - Text Processing
Identify the error in this command: sed s/apple/orange/g file.txt
AMissing quotes around the sed expression
BWrong delimiter used in substitution
CThe 'g' flag is invalid here
DFile name should come before the sed expression
Step-by-Step Solution
Solution:
  1. Step 1: Check sed command syntax

    sed expressions should be enclosed in quotes to prevent shell interpretation.
  2. Step 2: Identify missing quotes

    The command lacks quotes around s/apple/orange/g, causing syntax errors.
  3. Final Answer:

    Missing quotes around the sed expression -> Option A
  4. Quick Check:

    Quotes needed around sed expression = A [OK]
Quick Trick: Always quote sed expressions to avoid shell errors [OK]
Common Mistakes:
  • Omitting quotes around sed commands
  • Misplacing file name before expression
  • Confusing delimiter usage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes