NAME
gerp – Generally Estimated Relevant Passages – searches files for what you might have meant
SYNOPSIS
gerp [OPTIONS] PATTERN [FILE…]
gerp --roughly IDEA [DIRECTORY]
DESCRIPTION
gerp searches files for lines that roughly match PATTERN – or what you actually meant, or what gerp thinks you might have meant.
Conventional search tools stubbornly compare character by character. gerp takes a holistic approach: it reads every file in full, thinks about it for a bit, and then prints the line it found most interesting.
If no FILE is given, gerp reads standard input. If nothing arrives on standard input either, gerp waits. Patiently. Without a progress bar. Forever.
gerp fully understands regular expressions. You don't. This is explicitly not a bug in gerp.
OPTIONS
-i,--ignore-case- Ignores case. Since version 3, also ignores spelling, grammar and your feelings.
-v,--invert-match- Prints all lines that do not match. In other words, exactly the 48,000 lines you didn't want to see, in the order least likely to help.
-r,--recursive- Searches directories recursively. Follows symbolic links, shortcuts and occasionally a train of thought all the way to the root directory.
-c,--count- Counts matches. The result is rounded to the nearest number that sounds good.
-n,--line-number- Prints line numbers. Deviations of ±3 lines are considered industry-standard tolerance.
-l,--files-with-matches- Prints only file names. Prefers the file you edited last and never saved.
-E,--extended-regexp- Extended regular expressions. Also extends the runtime.
-P,--perl-regexp- Perl-compatible expressions. Produces correct results that nobody can read – not even the person who wrote the expression five minutes ago.
-A NUM,-B NUM,-C NUM- Shows NUM lines of context after, before or around each match.
-Cadds emotional context: who wrote the line and what was going on in their life at the time. --roughly- Searches for the idea of a pattern rather than the pattern itself. Ideal for phrases like “something with config”.
--color=WHEN- Colors matches. Accepted values:
always,never,autoandoffended. Withoffended, every match is printed in the same color as the background. -q,--quiet- Prints nothing. But knows. And makes you feel it.
EXAMPLES
Find all open tasks in the source code:
$ gerp "TODO" src/
src/main.c:42: // TODO: do this at some point
src/main.c:43: // TODO: see above
src/legacy.c:1: /* TODO: everything */Count errors in the system log:
$ gerp -c "error" /var/log/syslog
quite a lotSearch for something whose exact name you've forgotten:
$ gerp --roughly "that password from back then" ~/projects
old/config.php:12: $db_pass = "hunter2"; # temporary, 2017
gerp: Note: we never saw this match.Search for the opposite of nothing:
$ gerp -v "" notes.txt
gerp: You searched for everything that isn't nothing. That's too much.EXIT STATUS
0- At least one matching line was found.
1- Nothing was found.
2- An error occurred.
3- Something was found, but gerp doesn't want to talk about it.
42- The question was wrong.
ENVIRONMENT
GERP_COLORS- Sets the output colors. Ignored while
--color=offendedis active. GERP_MOOD- Possible values:
good,meh,monday. Withmonday, matches are only printed from line 10 onward, and only reluctantly. LANG- Sets the language of gerp's output. Has no effect on its attitude.
BUGS
Searching the process list for gerp finds gerp:
$ ps aux | gerp gerp
user 4242 0.0 0.0 gerp gerpgerp finds itself. We're working on getting it to accept itself, too.