1

I've switched to ACK-GREP recently (bye, bye standard grep) and the only thing I'm missing is the option to ignore whitespaces while searching.

Example:

@param(
    'lol', int, "Foo bar",
    can=False, hasBurger=True
)

and I want to find it by

ack @param('lol'

What do I have to change/add in .ackrc to force this behawior?

user2091046
  • 585
  • 1
  • 8
  • 20

1 Answers1

1

You can't. It is not due to the space but the new line. From the FAQ at the man page:

*Can I do multi-line regexes?*
   No, ack does not support regexes that match multiple lines.  Doing so would require 
   reading in the entire file at a time.

However, you can build your own pipe and delete all spaces:

 cat YOURFILE | tr -d [:space:] | ack --type=TYPE -o PATTERN

But I guess, this is not exactly what you want.

Matthias
  • 8,018
  • 2
  • 27
  • 53
  • Can you please suggest any other solution? – user2091046 Mar 10 '14 at 16:16
  • Now it does find something but I lose the info about line number. BTW Can I cat all the files and subfolders recursively this way? – user2091046 Mar 10 '14 at 16:38
  • Regarding recursion: you could use `xargs`: `find . -print0 | xargs -0 cat ...`. However, maybe you should have a look at [pcregrep](http://stackoverflow.com/questions/152708/how-can-i-search-for-a-multiline-pattern-in-a-file-use-pcregrep). – Matthias Mar 10 '14 at 16:47