Questions tagged [ag]
For questions on `ag` (a.k.a. The Silver Searcher), a RegEx-based code-searching tool optimized for speed.
19 questions
0
votes
1
answer
111
views
Uninstalled package but command remained usable as user (command not found with sudo)
I recently installed silversearcher-ag with sudo and uninstalled it as it required sudo to run the command every single time.
The command I used to install and uninstall this package respectively:
# ...
1
vote
2
answers
262
views
How can I limit the file size of files searched by ag?
I don't want ag to search files larger than 2Mio.
I can't find anything like a --file-size flag to the ag command, but is there any way to tell it that?
I'm getting lots of
ERR: Skipping foo.bar: ...
1
vote
0
answers
370
views
How can I recursively search file contents by ANDed patterns and print the output like ag/the silver searcher would?
This will be easier to explain via example. Here are my input files:
file1:
x
x
a
b
c
x
x
file2:
x
x
c
b
a
x
x
file3:
x
x
x x a b c x x
x
x
file4:
x
x
x x c b a x x
x
x
file5:
x
x
a b
x
x
file6:
...
1
vote
1
answer
283
views
How do I configure ag so that it will also search for files beginning with a "."?
I'm using ag v 2.2. How do I configure ag so that it will search for files beginning with a "." in addition to all other files? I'm noticing I have a file like so
$ cat client/.env....
0
votes
0
answers
144
views
How to get shell TAB-completion to work when I redirect grep ag ack output to vim?
I define ag as bash function, to make usage relatively transparent
ag() { [ $# -gt 0 ] && vim -c silent\ SyntasticToggleMode -c copen -q <(/usr/bin/ag --silent --vimgrep --nogroup "$@&...
1
vote
0
answers
152
views
How to make ag search "non-standard" langauge files?
I'm using Silver Searcher, ag, version 2.1.0 on Ubuntu. I'm trying to search for the string aStar in Haskell files in the current directory tree. (The files are text files with extension .hs.)
The ...
0
votes
0
answers
256
views
How to create a regex matching a custom string at the beginning of line while ignoring all preceding whitespaces via ag silversearcher?
Give an example file with the content:
// find me
val ignore me = "" // I should not be found
// find me
// find me
I want to find all the lines with find me using ag silversearcher.
Basically,...
0
votes
3
answers
68
views
Is it possible to print a search pattern result just until it hits a blank newline in terminal?
Say for example I have a file with contents like this:
# TODO: Optimize this.
alias bash='start bash'
# FIXME: Just fix this.
alias fix='there is something wrong with this
What I want is if I search ...
19
votes
1
answer
13k
views
How is ripgrep different from silver searcher ag? [closed]
Are these related?
Which is faster?
Can either be limited to directory-names?
https://github.com/BurntSushi/ripgrep
https://github.com/ggreer/the_silver_searcher
0
votes
1
answer
1k
views
search with and without a pattern with ag
With two files with
echo 'example.com/call_me?param' > file1.txt
echo 'example.com/call_me_maybe?param' >> file1.txt
echo 'example.com/call_me?' >> file1.txt
echo 'example.com/call_me?...
1
vote
0
answers
57
views
Can ag search sub-directories with the same name, within a bunch of directories?
Given a directory structure such as:
dev/project1/assets/**
dev/project2/assets/**
dev/project3/assets/**
Is it possible to search, from within the dev directory all assets directories only. Given ...
0
votes
1
answer
439
views
Ack/Ag does not return search result without *
I am trying to search text in a directory and it turned out that the following syntaxes do not return any result
ack -i "0xabcdef" ./
ack -i "0xabcdef"
ack -i "0xabcdef" .
while the following ...
16
votes
4
answers
13k
views
How to ignore multiple files with `ag` The Silver Searcher
There is an option --ignore which allows specifying files to ignore. At the moment I only managed to ignore multiple files by doing --ignore file1 --ignore file2.......
Trying to use --ignore "*...
71
votes
2
answers
45k
views
How do I use ag to look for text in files with certain extensions?
I'm using ag (The Silver Searcher) version 0.31.0. I can easily look for a string in a bunch of files using:
localhost:workspace davea$ ag 'ftp' .
But what if I only want to scan files with certain ...
6
votes
2
answers
921
views
How to make this search faster in fgrep/Ag?
I am thinking methods to make the search faster and/or better which principally uses fgrep or ag.
Code which searches the word and case-insensitively at $HOME, and redirects a list of matches to vim
...