Bird
0
0

Given a file data.txt with content:

medium📝 Command Output Q4 of 15
Linux CLI - Text Processing
Given a file data.txt with content:
John 25 Developer
Anna 30 Designer
Mike 22 Tester

What is the output of awk '{print $1, $3}' data.txt?
A25 Developer 30 Designer 22 Tester
BJohn 25 Anna 30 Mike 22
CJohn Developer Anna Designer Mike Tester
DDeveloper Designer Tester
Step-by-Step Solution
Solution:
  1. Step 1: Identify fields in each line

    Each line has fields: $1=Name, $2=Age, $3=Job.
  2. Step 2: Print first and third fields

    The command prints $1 and $3 separated by space, so output lines are "John Developer", "Anna Designer", "Mike Tester".
  3. Final Answer:

    John Developer Anna Designer Mike Tester -> Option C
  4. Quick Check:

    Print $1 and $3 fields correctly [OK]
Quick Trick: Match field numbers to data columns carefully [OK]
Common Mistakes:
  • Mixing up field numbers
  • Printing wrong fields
  • Confusing output format

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes