Using ack to search for regex in a specific file type

2

1

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

Somethingconcon

Posted 2012-08-03T19:17:58.113

Reputation: 21

Not sure about ack, but my go-to tools for such a task would be grep, followed possibly by find if there are a lot of nested folders we're going through. – Darth Android – 2012-08-03T19:19:30.970

Answers

0

Generally ack uses predefined file types, so the pessimistic answer is "No". However, if you regularly search in .scss files, you may want to set it as a file type in your .ackrc by adding the following line:

--type-set=sassy=.scss

voyager42

Posted 2012-08-03T19:17:58.113

Reputation: 1

0

"*.scss" isn't a regex, but shell globbing.

Like voyager42 says about, use

--type-set=sassy=.scss

in your .ackrc and then you can do

ack foo --sassy

or if you do NOT want to search sassy files

ack foo --nosassy

Andy Lester

Posted 2012-08-03T19:17:58.113

Reputation: 1 121