ggreer / the_silver_searcher

A code-searching tool similar to ack, but faster.
http://geoff.greer.fm/ag/
Apache License 2.0
26.17k stars 1.43k forks source link

Skip error ouput while earching #1490

Open maxpavlov opened 2 years ago

maxpavlov commented 2 years ago

I am searching for text occurrences in all files like this:

ag 'search term' /

However, searching the entire filesystem gives a lot of ERR: Permission denied errors which is fine. Is there a way (a param or whatever) to force the silver searcher to not output any errors and just display actual findings, if any?

If not, perhaps something to add to the backlog?

Thanks.

marcelocanales commented 2 years ago

Hi, you can use ag 'search term' / 2>/dev/null This is no ag options, you know, it redirects stderr (fd 2) to the black hole.