Re:Interesting commands for the Linux shell
by yodsanklai on Thursday September 14, 2017 @07:30AM
(#15246858)
I really like the "ag" command. Very convenient to grep in a bunch of files filtered by type. Example:
Very fast and simple syntax.
[ Parent
| on HN ]
Re:Interesting commands for the Linux shell
by kaushalmodi on Thursday September 14, 2017 @07:37AM
(#15246894)
Now try rg (ripgrep). It has a much more robust file ignore handling than ag in my experience.
When I last tried, ag couldn't handle this in .ignore file:
!foo.1
foo.*
That would ignore all foo.* files except foo.1 in rg.Also rg is a bit faster than ag for my use cases.
Re:Interesting commands for the Linux shell
by VeejayRampay on Thursday September 14, 2017 @08:04AM
(#15247072)
Is it possible to register new file formats in ripgrep though (say for example slim files so that I could do rg -tslim PATTERN)? Last time I checked it was somehow possible but way too complicated for so common a task.
Re:Interesting commands for the Linux shell
by kaushalmodi on Thursday September 14, 2017 @09:33AM
(#15247802)
From its README:
rg --type-add 'foo:*.{foo,foobar}' -tfoo bar
---You simply make the below into an alias:
rg --type-add 'foo:*.{foo,foobar}'
Or, if the type you need is generic that other users can also use, submit a PR. The developer was kind to except mine.. https://github.com/BurntSushi/ripgrep/pull/107/files .. it's a trivial 1-line PR.