>_ IzzyLab

Hands-on task

This task is step 16 of the course “awk and datamash: reports from tables”

Minimum and Maximum

medium~5 min

Using /root/sales.tsv, find both the minimum and maximum value in the second column at once and write them to /root/range.txt on one line (minimum, then maximum, separated by a tab — as the tool outputs).

What you'll practise:
  • datamash
  • column aggregation
  • min/max
  • multiple operations in one pass

Topic breakdown

datamash can compute several summary values in a single pass over the data — the operations are simply listed one after another, each given its own column: <op1> <col> <op2> <col>. For boundary values there are separate named operations — one for the minimum, another for the maximum. Applying both to the right column in one call gives you a single line of two numbers separated by a tab.

What's checked

  1. minimum and maximum are correct

What it looks like