Questions tagged [ack]

ack is a grep-like utility that allows searching using Perl-like regular expressions instead of the ed-like regular expressions from grep.

Note: On Debian systems and derivatives like Ubuntu it's called ack-grep due to a naming conflict with a Kanji-related tool which is named ack, too.

38 questions
29
votes
1 answer

Limiting silver-searcher to only search specific file types

I'm doing ag "active_record" ., but I want to only care about .rb files. How do I limit what file types it searches on the command line?
7
votes
2 answers

How do you ack for a file that contains two or more phrases/words?

How do you use ack to search for a file that contains, for example, cat dog mouse anywhere in the file? Each phrase occur at least once in the file. This is kind of like the behavior of an online search engine. Bonus: Can we use regex on those…
hobbes3
  • 1,013
6
votes
2 answers

Show line number when search a single file

ack usually shows line numbers with file name, $ ack searchme filename 1:searchme but it doesn't when search a single file, $ ack searchme filename searchme It's easy to show line numbers with grep $ grep -n searchme filename 1:searchme Can I…
2
votes
1 answer

Showing line number with filename in ack

when I search using ack I get results like this /path/to/file/name 42: goes here How do I get ack to return results like this instead: /path/to/file/name:42 : goes here
2
votes
2 answers

Using ack to search for regex in a specific file type

Wondering if there's a way to look for something like ack foo "*.scss"
0
votes
1 answer

Why doesn't --type-set work in ack?

In my .ackrc file I have this line --type-set=vm=.vm But when I run ack-grep --vm blah it searches all types of files. Neither does this work: ack-grep blah --type-set vm=.vm ack-grep --type-set vm=.vm blah Why?
sean hawk
  • 103
0
votes
1 answer

Conflicting type flags in ack

I have added a custom type to my .ackrc and it does just what I want. --type-set=test:match:/_test\b/ It matches unit test files. Since I don't want to see test usages more often than I do, I also set --notest However, when I want to search…