Interview Prep/Real-World Interview/awk, sed, grep and jq one-liners

Print the 3rd column of a CSV whose fields are separated by commas, skipping the header.

BeginnerHands-onawk, sed, grep and jq one-liners
Answer
awk -F, 'NR > 1 {print $3}' data.csv

Key trick → NR is the overall line number. Note that this naive split breaks on quoted fields containing commas; for real CSV use python -c 'import csv…' or mlr.

All Real-World Interview questions Roadmap: Interview readiness

More on awk, sed, grep and jq one-liners