>_ IzzyLab

Hands-on task

This task is step 15 of the course “Text in the terminal: grep, sed, awk”

Slow CI builds

medium~5 min

/root/builds.txt has lines job branch seconds — how long each CI build took. Write to /root/slow_builds.txt whole lines, only those where the build took longer than 300 seconds, in the original order.

What you'll practise:
  • awk
  • field condition
  • numeric comparison
  • line filtering

Topic breakdown

The pattern in front of an action in awk is a filter: the action runs only for lines where the expression is true, and without an action the line is simply printed. So "keep the lines where a column is greater than a threshold" is a single condition. awk compares number-like fields numerically; with a text comparison 95 would come out greater than 300, because the comparison would go character by character.

What's checked

  1. the file has only builds longer than 300 seconds

What it looks like