Bird
0
0

Find the error in this awk command:

medium📝 Debug Q7 of 15
Linux CLI - Text Processing
Find the error in this awk command:
awk '{print $1 $2}' filename
AIncorrect field numbers
BMissing comma or space between $1 and $2 in print
CMissing pattern before action
DExtra curly braces
Step-by-Step Solution
Solution:
  1. Step 1: Understand print syntax for multiple fields

    To print multiple fields with space, separate them by comma or add space explicitly.
  2. Step 2: Identify missing separator

    Command prints $1 and $2 concatenated without space, likely unintended.
  3. Final Answer:

    Missing comma or space between $1 and $2 in print -> Option B
  4. Quick Check:

    Print multiple fields needs comma or space [OK]
Quick Trick: Use comma to separate fields in print for spaces [OK]
Common Mistakes:
  • Concatenating fields without separator
  • Confusing field numbers
  • Expecting implicit space between fields

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes