Grokking DevOps and SRE Interviews
Vote

0% completed

​

Bash for Interviews

awk '{print $9}' access.log | sort | uniq -c | sort -rn | head -3
41870 200 2214 404 610 502

This one line counts the HTTP status codes in a web server log, in which the ninth field of each line is the status. Four small programs each do one job, and the shell connects them.

A short pipeline like this answers many small questions about text data. The shell that connects the programs also has rules that cause failures in longer scripts, for example when a file name contains a space or when a script continues after a failed command.

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content