2

In ack you can use the -Q option to escape all the characters in your search string, but that doesn't seem to work if the search string you are using looks like an option for ack.

I am trying to search a group of files for the string '--branch'. So I try this ack command

ack -a -Q '--branch'

It responds Unknown option: branch. It is seeing my search string as an option to be interpreted. Does anyone know what escape characters I can use to use the --branch as a string?

bryan kennedy
  • 6,969
  • 5
  • 43
  • 64

2 Answers2

4

Ack uses the Getopt::Long module to process command line arguments, so it supports the -- option to indicate that you want option processing to end at that point in the argument list.

ack -a -- --branch

should therefore work (it does for me).

martin clayton
  • 76,436
  • 32
  • 213
  • 198
1

Maybe with --match PATTERN option?

http://betterthangrep.com/

yunzen
  • 32,854
  • 11
  • 73
  • 106