Sum the response sizes (field 10) in an Nginx access log and print the total in MB.
BeginnerHands-onawk, sed, grep and jq one-liners
Answer
awk '$10 ~ /^[0-9]+$/ {s += $10} END {printf "%.2f MB\n", s/1024/1024}' access.log
Key trick → The regex guard skips - values (no body), which would otherwise be counted as 0 silently or break other tools.
More on awk, sed, grep and jq one-liners
Print only the lines containing "ERROR" with 3 lines of context, and show line numbers.BeginnerReplace `DEBUG` with `INFO` in a config file in place, keeping a backup.BeginnerExtract all unique email addresses from a file.BeginnerFrom `kubectl get pods -A -o json`, list pods that are not Running, as namespace/name/phase.IntermediatePrint the 3rd column of a CSV whose fields are separated by commas, skipping the header.BeginnerDelete all blank lines and comment lines from a config file and show what's actually active.Beginner