Questions tagged [ag]

The Silver Searcher, better known as Ag is a tool similar to ack.

The Silver Searcher, better known as Ag is an open-source tool similar to created and maintained by Geoff Greer.

115 questions
0
votes
1 answer

Ag command on local against remote files

I installed ag on localhost and then localhost has access to remote host, I don't want to install ag on remote host, instead I'd like to use ag from localhost to run against files in remote host. I'm thinking some kind of proxy ag command or run ag…
Tuyen Pham
  • 300
  • 3
  • 14
0
votes
1 answer

ag and rg not listing files starting with underline, find does

If I do: touch _gandalf And then: rg --files | grep gandalf | wc -l or ag -l -g "" | grep gandalf | wc -l I get 0 matches as result. Now if I do a touch gandaf I get 1 match. Why is that? Does files starting with underline have a similar…
Jean Carlo Machado
  • 1,480
  • 1
  • 15
  • 25
0
votes
1 answer

Bash syntax errors when trying to run silver searcher

I'm trying to find instances of $ which are not followed by !. That should necessitate $, escaped, which is \\$ and [^!] escaped which should be [^\\!] unless the [ and ] need to be escaped as well? Not sure about this one - don't know enough about…
fIwJlxSzApHEZIl
  • 11,861
  • 6
  • 62
  • 71
0
votes
1 answer

Interactive Elisp Function to Directly Search File Names with `emacs-helm-ag` (-g option)

I use emacs-helm-ag to search file content and file names in a project. My emacs-helm-ag configuration is: ; Helm Ag mode (add-to-list 'load-path "~/.emacs.d/emacs-helm-ag") (require 'helm-ag) (custom-set-variables '(helm-ag-base-command "ag…
0
votes
2 answers

How can I escape a single quote in ag (without using double quotes)

How can I escape a single quote in ag when searching for an expression like this one? ag ''react-redux'' I'm aware that "'react-redux'" is one solution in this scenario, but I'd like a solution that lets me use single quotes. That way I don't have…
achalk
  • 3,229
  • 3
  • 17
  • 37
0
votes
1 answer

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 command works ack -i "0xabcdef" * Can someone explain…
user2979872
  • 413
  • 1
  • 9
  • 20
0
votes
1 answer

Writing a script to filter out text reports based on given conditions and outputs desired values

I've long list of generated reports which I want to filter. The report is something like this: Report Name Report Date Blah blah blah Parameter1: 85.34% Blah blah Paramter2 FF_6 Parameter3: 345 Parameter4: value blah blah OutputVar1:…
SddS
  • 587
  • 1
  • 5
  • 17
0
votes
2 answers

How to find and search in all files with hashtag in specific line

I'm trying to find a way to scan a folder on my OSX system for all files containing a specific string of text(#SomeTag") in specific line(hashtag in first line). Just to clarify, I'm looking for text within the file, not in the file name. I tried…
emKaroly
  • 756
  • 1
  • 10
  • 22
0
votes
1 answer

How can I find and replace with a variable using a list of filenames piped to sed?

Currently I find and replace using the following: ack -l oldstring | xargs sed -i '' -e s/oldstring/newstring/g Is there a way to do this without having to type out oldstring more than once? This is what I'm trying that does not work: ack -l…
YPCrumble
  • 26,610
  • 23
  • 107
  • 172
0
votes
1 answer

Vim/Ag: files whitelist in AgFromSearch

I am using vim with Ag.vim(silver-searcher) and i came across a problem. the Ag plugin defines Ex mode commands such as :Ag and :AgFromSearch. but while :Ag lets me pass options to the shell's ag command such as -G which lets me whitelist files,…
user3848844
  • 509
  • 6
  • 20
0
votes
1 answer

cut down directory against relative directory from ag results

If search in a long path directory like a/long/long/long/path/to/project/ with ag, the results list will contain the long path. Is there a way to get ride of project path in result list? Example results list of ag test…
tjfdfs
  • 729
  • 10
  • 26
0
votes
2 answers

Regex to find that there is no string

... ... ... ... ... How using ag or grep find such blocks in many files, that have no…
vladon
  • 8,158
  • 2
  • 47
  • 91
0
votes
1 answer

Why is Ag slower than grep?

So recently I was searching on command line tools that perform fast search and I stumbled upon a lot . Out of those it is my understanding that Ag is reportedly faster than grep, ack, and sift. With grep being the slowest. now I have 300.000…
RetroCode
  • 342
  • 5
  • 14
0
votes
1 answer

Regex with Silver Searcher in Tmux + ZSH falis

I'm trying to ag results through a pipe using a regular expression but it is not working. ~/c/octoly git:1470 ❯❯❯ drake routes | ag pro_store --page=less -r …
Adrien
  • 2,088
  • 1
  • 18
  • 35
0
votes
1 answer

ag: Search all folders except for folderName/subFolder (Perl Regex)

I have these folders that have subfolders in them... locales/US/en locales/US/fr locales/FR/en locales/FR/fr locales/DE/en locales/DE/fr public test [...] I want Silver Searcher to ignore locales/* EXCEPT for locales/US/en/* (essentially I only…
Jamis Charles
  • 5,827
  • 8
  • 32
  • 42