NUMGREP(1)
β¨ NUMGREP(1) β¨
okay so bestie, welcome to the User Contributed Perl Documentation page for numgrep π it's the numeric version of grep, which β if you know grep β is already iconic, but this one only cares about numbers. no cap.
πΈ NAME πΈ
numgrep β bestie, this program is the numeric equivilent of the grep utility. (yes, "equivilent" β that's how it's spelled in the original, we do not correct the queen π«Ά)
π SYNOPSIS π
numgrep [-dhlV] <FILE>
| numgrep [-dhlV] (Input on STDIN from pipeline.)
numgrep [-dhlV] (Input on STDIN. Use Ctrl-D to stop.)
so you can feed it a file, you can pipe into it, or you can just type at it and hit Ctrl-D when you're done. all three? valid. π
π¦ DESCRIPTION π¦
numgrep searches for different occurrences of numbers through the use of numeric expressions. that's the whole vibe. it doesn't do text matching, it does number matching, and honestly? it ate. π₯
β¨ OPTIONS β¨
-lβ Print the matching numbers out one per line instead of printing the entire line they are on. like, just the number bestie, no context, we love a minimalist π-hβ Help: You're looking at it. literally. this is it. hi π-Vβ Increase verbosity. she gets chatty π’-dβ Debug mode. For developers. so like,-dis for the ones reading the source at 3am π§
π EXPRESSIONS π
numgrep uses a special numeric expression matching system. Basically, it searches for ranges, factors and sequences of numbers. Here is a list of the syntax characters and some sample expressions that will get you going:
/<expression>/β Put your expression or set of expressions between these two forward slashes. the slashes are the outfit, the expression is the girl π..β Range expression. A number must be used on the left and/or right of this expression to specify that numbers between, greater than or less than the numbers specified should be matched. open-ended ranges are valid, it's giving infinite β¨,β Expression separator. The comma separates one complete expression from another in a set enclosed by//. think of it as the "and also" of the number world π«Άm<n>β Multiples of<n>. This operator, followed by a number<n>will match any number<x>that is an integer multiple of<n>. Meaning that<x>=<n>times<y>, where<y>is any integer. math girlies rise πf<n>β Factors of<n>. This operator, followed by a number<n>will match any number<x>that is an integer factor of<n>. Meaning that<x>=<n>divided by<y>, where<y>is any integer.
NOTE: Checking for factors and multiples is very fast because it is checked by doing a single modulus operation on two numbers. one modulus. that's the whole trick. she's efficient AND pretty π
π Examples π
/2..10/β Match any number between 2 and 10./2..10,20..30/β Match any number between 2 and 10 or between 20 and 30./56,34,512,45,67/β Match any of the numbers 56, 34, 512, 45 or 67./m3/β Match any integer that is a multiple of 3./f1024/β Match any integer that is a factor of 1024.
and here's the little demo moment, straight from the source, character for character:
$ numrange -N /1..1000/ | numgrep /f1024/
1
2
4
8
16
32
64
128
256
512
$
look at her go π all the factors of 1024 lined up like a little parade π
π BUGS π
numgrep can't handle certain situations properly. Such as if it encounters a number with leading zeros, it will treat it as an octal number and thus might not match the way you would expect. so like, 007 is not giving what you think it's giving. watch out π¨
numgrep does not yet allow you to mix numbers and text in the matching expression. So you can not do something like numgrep /port=0..1023/ firewall.log. But this will be changed in the future. fr fr, one day π
π SEE ALSO π
numaverage(1), numbound(1), numinterval(1), numnormalize(1), numprocess(1), numsum(1), numrandom(1), numrange(1), numround(1)
the whole num-utils friend group π go say hi to all of them.
π COPYRIGHT π
numgrep is part of the num-utils package, which is copyrighted by Suso Banderas and released under the GPL license. Please read the COPYING and LICENSE files that came with the num-utils package
Developers can read the GOALS file and contact me about providing submitions or help for the project. (again: "submitions" β verbatim, we don't touch it π«Ά)
π BUGS (yes, again) π
numgrep will round decimal numbers with more than 15 digits of accuracy. This is mostly due to limit's in the way programming languages deal directly with numbers. so like, past 15 digits it's giving vibes, not precision π
π MORE INFO π
More info on numgrep can be found at:
http://suso.suso.org/xulu/Num-utils
okay that's the whole page bestie, you're officially numgrep-pilled π
this was perl v5.30.3, dated 2020-06-09, and you have been served the NUMGREP(1) page in full. slay, stay numeric, and remember: check your factors before you wreck your factors β¨π¦ππ
π¦ where this page comes from
- debian bookworm: num-utils 0.5-15 Β· GPL-2.0-or-later
- debian trixie: num-utils 0.5-15 Β· GPL-2.0-or-later
- ubuntu jammy: num-utils 0.5-15 Β· GPL-2.0-or-later
- ubuntu noble: num-utils 0.5-15 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms