Bird
0
0

Given a file data.csv with content:

medium📝 Command Output Q4 of 15
Linux CLI - Text Processing
Given a file data.csv with content:
name,age,city
Alice,30,NY
Bob,25,LA

What is the output of cut -d ',' -f 2 data.csv?
Aname Alice Bob
B30 25
Ccity NY LA
Dage 30 25
Step-by-Step Solution
Solution:
  1. Step 1: Identify delimiter and field

    The command uses comma as delimiter and extracts the 2nd field (age).
  2. Step 2: Extract 2nd column values

    From the file, the 2nd column values are 'age', '30', and '25'.
  3. Final Answer:

    age 30 25 -> Option D
  4. Quick Check:

    Field 2 with comma delimiter = age,30,25 [OK]
Quick Trick: Use -d ',' and -f to extract specific CSV columns [OK]
Common Mistakes:
  • Extracting wrong field number
  • Ignoring header line
  • Using wrong delimiter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes