Bird
0
0

Identify the error in this awk command:

medium📝 Debug Q6 of 15
Linux CLI - Text Processing
Identify the error in this awk command:
awk '{print $1 $2,}' file.txt
AMissing space between $1 and $2
BNo error, command is correct
CIncorrect use of single quotes
DExtra comma after $2 causes syntax error
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the print statement syntax

    The comma after $2 is invalid syntax inside print block without a following argument.
  2. Step 2: Confirm error cause

    Extra comma causes awk to expect another argument, resulting in syntax error.
  3. Final Answer:

    Extra comma after $2 causes syntax error -> Option D
  4. Quick Check:

    Trailing commas in print cause syntax errors [OK]
Quick Trick: Avoid trailing commas in print statements [OK]
Common Mistakes:
  • Leaving trailing commas
  • Confusing concatenation with comma
  • Misusing quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes