Instead of just typing
rg '\bfoo\b'
you get to type rak '/ << foo >> /'
and instead of just typing rg -B2 -A2 foo
or rg -C2 foo
you get to type rak foo --before=2 --after=2
(over double the characters!) and instead of just typing rg 'foo.*bar|bar.*foo'
you get to type rak '{.contains("foo") && .contains("bar")}'
which has double the characters and also has the advantage of writing each pattern only once.Okay, I haven't actually tried it (and the README doesn't say how to), and rak does have a bunch of features and capabilities ripgrep doesn't have, but those first examples are not very inspiring after the big initial claim.
rg -B2 -A2 foo
can be written as rg -C2 foo
although this does not underline your point as much. grep -R -C2 foo .So
rak -C2 foo
will do what you expect.[Edited to add] Also, the `\b...\b` form is shorter with rak - as the README also states where it documents this pattern form:
> §string
> If the pattern starts with §, then it indicates that the string should occur as a word (with word-boundaris on both ends) in the item. Basically a shortcut to specifying string --type=words. Any --smartcase, --smartmark, --ignorecase or --ignoremark arguments will be honoured.
Typing § is not very easy on most keyboards, and is actually impossible on some keyboard-OS combinations (including mine): https://en.wikipedia.org/wiki/Section_sign#Keyboard_entry
> If the pattern starts with §,
Is it April 1st already?!
I wonder if keyboards in the future will settle on a way to provide access to more characters, than is currently common.
I agree the keyboard thing is really annoying. Maybe the West should investigate the efforts China has put into different typing systems.
U+00A7 (codepoint 167) is also the Unicode codepoint for §. Its use on this very web page is via Unicode and the UTF-8 encoding as the bytes \xC2\xA7.
(This is meant as a narrow correction. It doesn't really change the broader point that § is not exactly easy to type on most keyboards. Whether its ASCII or not.)
https://keyshorts.com/blogs/blog/37615873-how-to-identify-ma...
Do the "contains" example with 5 terms.
rg foo1 | rg foo2 | rg foo3 | rg foo4 | rg foo5
or, if filename matches are a possibility rg foo1 | rg :.\*foo2 | rg :.\*foo3 | rg :.\*foo4 | rg :.\*foo5
vs rak '{.contains("foo1") && .contains("foo2") && .contains("foo3") && .contains("foo4") && .contains("foo5")}'
My point is that despite their claim of superiority, their examples do not show any. Maybe there's a more efficient rak way to do that chain of .contains? Why not demonstrate that? rak '{so one ["foo1", "foo2", "foo3"].map(-> \x{$_.contains(x)})}'
That's a bit though; it'll match lines that contain exactly one of "foo1", "foo2", "foo3", but not zero or 2+.This actually shows one of the secret powers of the Raku Programming Language: Junctions https://docs.raku.org/type/Junction
Alternately one could express this as:
$ rak '{.contains: <foo1 foo2 foo3 foo4 foo5>.all}'
Or using whatever currying: https://docs.raku.org/type/Whatever
$ rak '*.contains: <foo1 foo2 foo3 foo4 foo5>.all'
Whait what's that? I'm stuck with ag and {a..z}grep.
I'm curious (like others here) how `rak` is better than `rg`.
In contrast "rg" only designed to search text files, but it does that really really fast.
I makes sense to have both.
- support for --ignoremark, which means you 'e' will match any accented 'e', such as éëêèęėē.
Have you found folks using these particular Unicode features in practice? I don't think anyone has request it for ripgrep.
Well, but that's only one of the reasons why rak is a lot slower. There's something else going on, but I currently don't have the mindset to investigate this deeply.
rak is backed by the entirety of raku language and therefore is much easier for some crafting something that's less trivial to generalize in a one-liner. For most of grep-alike tools, their regex engine would be some sort of ceilings of what can be done but for rak, the ceiling is as tall as the raku programming language. That's rak's niche.
Alongside `fzf` and `fd` (a similar project for `find`) `rg` was what finally convinced me to put together a few shell scripts to bootstrap getting all my favorite modern command line tools on a new Ubuntu VM [1]. I'm working on an interactive playground you'll be able to SSH into to try it out yourself without even having to spin up your own, so you can see the difference with your own two eyes, no VM required.
At my previous job I often ended up searching raw log files sized around 5-8GB. Regular grep would grind away for 50-60 seconds, while ripgrep returned the same results in 250ms.
I was shocked the first time I used it and have sung it's praises since.
I have used (at different places) Graylog and Splunk, New Relic is also popular.
Not that ripgrep isn't awesome, but you could have dedicated indexing and a UI that can be shown to non-technical or at least semi-technical people to review logs whereas "Just use ripgrep" really isn't accessible for most users.
TBH more frequently I have "argument list too long" problem, than "one 5GB file" problem.
(...I am somewhat disappointed that I don't have a ridiculously buff nose by now but at least it matches the rest of my body).
Thanks, I wouldn't have been able to tell otherwise.