Linux

grep / sed / awk Helper

Build reliable grep, sed, awk and cut commands: shell-escaped pattern, useful options and common variants.

How it works

grep searches, sed transforms, awk analyses columns: the basic trio of text processing on Linux, essential for exploring logs.

The tool escapes the pattern for a POSIX shell and recalls the useful options: -n (line numbers), -i (case-insensitive), -r (recursive), -E (extended regex), -- to protect a pattern starting with a dash.

Examples

Errors in a log

grep -n -- 'ERROR' file.log

patternERROR
modegrep
Load this example

Replacement

sed -i.bak 's/old/NEW/g' file.txt

patternancien
modesed-replace
Load this example

Frequently asked questions

Why use -- after grep?

So that the pattern is not interpreted as an option, for example with a pattern starting with a dash.

grep or ripgrep?

grep is universal; ripgrep (rg) is much faster on large repositories and ignores .gitignore automatically.