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

Find the slowest 10 requests in a log where the last field is response time in seconds.

IntermediateHands-onawk, sed, grep and jq one-liners
Answer
awk '{print $NF, $7}' access.log | sort -k1,1 -gr | head -10

Key trick → $NF is the last field, whatever the number of columns. sort -g handles decimals and scientific notation; -n is fine for plain decimals.

All Real-World Interview questions Roadmap: Interview readiness

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