Bird
0
0

Which sed command deletes the 3rd line from a file named data.txt?

easy📝 Conceptual Q2 of 15
Linux CLI - Text Processing
Which sed command deletes the 3rd line from a file named data.txt?
Ased 'd3' data.txt
Bsed '3d' data.txt
Csed 'delete 3' data.txt
Dsed '3delete' data.txt
Step-by-Step Solution
Solution:
  1. Step 1: Recall sed delete syntax

    To delete a specific line, use the format 'N d' where N is the line number.
  2. Step 2: Match with options

    sed '3d' data.txt uses '3d' which means delete line 3. Other options are invalid syntax.
  3. Final Answer:

    sed '3d' data.txt -> Option B
  4. Quick Check:

    sed delete line syntax = 'Nd' [OK]
Quick Trick: Use 'Nd' to delete line N in sed [OK]
Common Mistakes:
  • Writing 'd3' instead of '3d'
  • Using full words like 'delete' which sed doesn't recognize
  • Confusing delete command with substitution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes