-2

I'm having trouble recently using silver searcher.

There are 2 files in a directory containing same content:


A.cpp:

This is a cpp file


B.cpp:

This is a cpp file


However, $ ag cpp returns the result of B.cpp, not that of A.cpp:

B.cpp

1:This is a cpp file

How do I deal with that?

Here is the ag command man page

Community
  • 1
  • 1
  • I installed silver search on my mac, created a directory and two files like you did, ran the same command and it listed both files correctly. Are you sure your file permissions are OK and you're searching the right directory and the files contain what you think they do? – clearlight Jan 02 '17 at 07:07
  • Something to keep in mind is that this site isn't here to debug a 3rd party command like that. That would be something you'd want to take up with the open source project authors or maybe diagnose and fix the bug yourself. – clearlight Jan 02 '17 at 07:09
  • You might found useful [this answer](https://stackoverflow.com/a/28056235/4970442). – Pablo Bianchi Jul 15 '17 at 01:47

1 Answers1

2

I guess A.cpp has been ignored.

Check your .gitignore and .ignore, etc..

Or you simply search all files with $ ag cpp -u.

See more detail by

$ ag | ag "unrestricted"

-u --unrestricted Search all files (ignore .ignore, .gitignore, etc.; searches binary and hidden files as well)

Rahn
  • 4,787
  • 4
  • 31
  • 57