Find things with grepCommand line · 0/4 steps

Search for a patternstep 1 of 4 · beginner

Support

The command is shown. Click it to run, or type your own.

By the end of this lesson you can
  • Print lines matching a pattern with grep PATTERN FILE
  • Count matches instead of printing them with grep -c
  • Match whole words (-w) and ignore case (-i)
  • Use grep as a filter inside a pipeline

Before you startPipes and filters: the pipe | and the cut | sort | uniq -c idiom.

grep PATTERN FILE prints every line of the file that contains the pattern. Let's find the missense variants.

Find every line mentioning missense in variants.tsv.

the filechr1 BRCA1 HIGHchr2 EGFR LOWchr1 TP53 HIGHchr3 MYC MODERATE
grep HIGH
what you getchr1 BRCA1 HIGHchr1 TP53 HIGH
grep reads every line and keeps only the ones that match your pattern; the rest are dropped.
Note

The name grep comes from an old text editor command, g/re/p, globally search a regular expression and print. Once you learn regular expressions, that same pattern language works in grep, sed, awk, and most programming languages.

workspace · terminal

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…
Command line0 / 4 stepsStep 1WASM shell