How to escape double quotes and colon in ACK in PowerShell

Question:

I am using Ack version 2.04, in PowerShell. I want to search texts like “jsonClass”:”Page” (quotes included) inside text files.

I can’t seem to get the quoting and escaping correct.

It doesn’t work in PowerShell. I guess ack’s picking up the single quotes as well.

Escaping the double quotes gives an invalid regex error:

I tried the literal option as well, but I think ack’s interpreting the colon as file parameters.

What am I missing?

I am using PowerShell v2.

Answer:

If ack is a function it could happen that -c is interpreted by PowerShell. Can you test the following?

-c --match should be interpreted as --match is the value of parameter c in function ask.

If it’s an EXE file, try:

Source:

How to escape double quotes and colon in ACK in PowerShell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply