How do I use ag to look for text in files with certain extensions?
Per the manual, you could use ag
with -G
-G --file-search-regex PATTERN
Only search files whose names match PATTERN.
e.g.
ag -G '\.java$' 'ftp' .
Per the same manual
It is possible to restrict the types of files searched [...]
For a list of supported types, run ag --list-file-types.
So you could also run
ag --java 'ftp' .
though that would restrict the search to file names ending in .java
or .properties