Bird
0
0

What will be the output of this command?

medium📝 Command Output Q5 of 15
Linux CLI - Text Processing
What will be the output of this command?
echo "one two three" | awk '{print $3}'
Atwo
Bthree
Cone
Done two three
Step-by-Step Solution
Solution:
  1. Step 1: Understand awk field numbering

    Fields are separated by spaces; $3 refers to the third word.
  2. Step 2: Identify the third word

    Input is 'one two three', so third word is 'three'.
  3. Final Answer:

    three -> Option B
  4. Quick Check:

    awk '{print $3}' output = three = A [OK]
Quick Trick: Fields start at $1; $3 is third word [OK]
Common Mistakes:
  • Printing $1 or $2 instead of $3
  • Expecting full line output
  • Confusing awk with cut command

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes