DEV Community

y4u
y4u

Posted on

[In Development] grep -v and grep -w, Now in a GUI: NOT Filters and Whole-Word Match for Huge-File Search

The reality of log investigation is less about finding and more about discarding and pinpointing. In CLI land:

grep ERROR big.log | grep -v healthcheck | grep -v "known-issue-123" | grep -w timeout
Enter fullscreen mode Exit fullscreen mode

I develop a huge-file viewer (UwView Pro), and I've been bringing exactly these grep ideas into its drill-down search. Every stage now carries four checkboxes — Regex, Ignore case, Whole word (-w), Exclude (-v) — freely combinable, stackable up to 8 stages. Both are in-development features from a pre-release build; more CLI-flavored ones are on the way.

Part 1: the NOT filter (grep -v) — 10,967 → 16

On the OpenStreetMap Japan XML (real data, 892 million lines):

  1. Tokyo10,967 hits
  2. NOT 医療 (medical) — 10,949
  3. NOT 消防 (fire dept.) — 10,928
  4. include 横浜 (Yokohama) — 16 hits

The closest grep expression: grep -C 1 Tokyo | grep -v 医療 | grep -v 消防 | grep -C 1 横浜. Unlike a one-way pipe, every stage persists as a clickable tab with its hit count — jump back anytime; the refinement path doubles as the investigation record.

Part 2: whole-word match (grep -w) — 10,967 → 7

Substring search catches error_count when you wanted error. The new Whole word checkbox is -w:

  1. Tokyo10,967 hits
  2. Ariake with Whole word checked — 7 hits ("Tokyo – Ariake Supercharger," "Tokyo Ariake University"…)

Seven rows out of 892 million, in two stages. Closest CLI: grep -C 1 Tokyo | grep -w Ariake.

The mapping (close, not identical)

CLI UwView Pro
grep -C 1 PATTERN an include stage (±1 line of context)
grep -v the Exclude checkbox
grep -w the Whole word checkbox
grep -i / grep -E Ignore case / Regex
> hits.txt Save… (line numbers, CSV header, ±N context options)

Close, not identical: drill-down refines ±N-line context blocks while a pipe streams lines, so edge cases differ; -v stages carry no -C (meaningless in grep), and word-boundary definitions differ in fine print. Also new: the screenshots run in the app's English UI.

Honest limits

  • Both features are in development — pre-release build, details may change; I'll update at release
  • Scripting, automation, cron: still CLI territory. For a one-off search, grep is plenty
  • This shines in interactive investigation — when you don't yet know what to discard
  • Hit counts are my own runs on one file

UwView Pro is on sale (Windows, macOS, Linux — one license covers all three; 14-day free trial — editing features included). Screenshots and full details:

Top comments (0)