Print a fieldstep 1 of 4 · intermediate
Support
The command is shown. Click it to run, or type your own.
By the end of this lesson you can
- Print a chosen field with
awk '{ print $2 }' - Keep only rows that match a condition (
$4 == "HIGH") - Accumulate a running total and print it in an
ENDblock - Filter rows numerically, e.g.
$3 > 300
Before you startColumns with cut and filtering with grep; awk generalises both.
In awk, $2 is the second field of the current line. { print $2 } runs on every line.
Print the gene column of variants.tsv with awk.
chr1$1BRCA1$2missense$3HIGH$4Key concept
Every awk rule has the shape condition { action }. Omit the condition and the action runs on every line; omit the action and matching lines are printed. That one idea, a pattern paired with what to do, is the whole language in miniature.
Type a command, or click the suggested one. ↑/↓ recall history, Tab completes file names. New to this? Hit Explain this command to see it in plain English.
workspace/shared/data0 files
Booting the WebAssembly runtime…