Skip to content
gohacks.dev
Tooling

Filter Lines Like grep

Keep or remove lines that match a pattern, with regex or plain text, case-insensitive matching, context lines, only-matching output and the equivalent grep flags.

Free · No sign-up · Your inputs stay in your browser

Input

Filter lines like grep

Output

Matching lines

3 of 5 lines. Equivalent: grep -iE 'ERROR|WARNING'

The equivalent grep flags are shown above the output. On large files ripgrep (rg) is much faster, and it skips binary files and .gitignore'd paths by default. JavaScript regex syntax here is close to grep -E, but \d works here and needs grep -P on GNU grep.

Runs in this browser. Nothing you paste is sent to a server.

grep flags, side by side

-v inverts, -i ignores case, -F treats the pattern as plain text, -E uses extended regex, -o prints only the match and -C n adds context. The output names the combination you chose, so the same filter can be run on the full file on the server. The GNU grep manual documents them.

Regex flavours

This page uses JavaScript regex, which is close to grep -E. Shorthands such as \d are not in POSIX extended regex: GNU grep needs -P for them, and macOS grep does not support -P at all.

Share

Frequently asked questions

How do I show lines that do not match?
Turn on Remove matching lines, the same as grep -v.
How do I search a large log file?
On the server, grep or ripgrep (rg), which is much faster on large files and skips binary files by default.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools