Bird
0
0

What does the cut -d, -f2 file.csv command do when processing a CSV file?

easy🧠 Conceptual Q11 of 15
Bash Scripting - File Operations in Scripts
What does the cut -d, -f2 file.csv command do when processing a CSV file?
ADeletes the second column from the CSV file
BExtracts the second column from the CSV file using comma as delimiter
CCounts the number of commas in the CSV file
DReplaces commas with tabs in the CSV file
Step-by-Step Solution
Solution:
  1. Step 1: Understand the cut command with delimiter

    The -d, option sets the delimiter to a comma, which is the separator in CSV files.
  2. Step 2: Extract the specified field

    The -f2 option extracts the second field (column) from each line of the file.
  3. Final Answer:

    Extracts the second column from the CSV file using comma as delimiter -> Option B
  4. Quick Check:

    cut -d, -f2 extracts column 2 [OK]
Quick Trick: Use -d for delimiter and -f for field number in cut [OK]
Common Mistakes:
MISTAKES
  • Confusing -f with line number
  • Using wrong delimiter character
  • Thinking cut deletes columns

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Bash Scripting Quizzes