Bird
0
0

Identify the error in this awk command:

medium📝 Debug Q6 of 15
Bash Scripting - Text Processing in Scripts
Identify the error in this awk command:
awk '{print $2}' -F: file.txt
AThe -F option should come before the program
BThe $2 field is invalid syntax
CMissing quotes around -F:
DFile name should come before the program
Step-by-Step Solution
Solution:
  1. Step 1: Check option placement

    The -F option must be placed before the awk program, not after.
  2. Step 2: Correct command order

    Correct syntax: awk -F: '{print $2}' file.txt.
  3. Final Answer:

    The -F option should come before the program -> Option A
  4. Quick Check:

    Options before program [OK]
Quick Trick: Place options like -F before the awk script [OK]
Common Mistakes:
MISTAKES
  • Putting -F after the program
  • Misplacing file name
  • Using wrong quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes