3

我不知道如何转义“<”字符,并且对“系统找不到指定的文件”错误感到困惑。任何人都可以帮忙吗?

我在 Windows XP 的 powershell 中使用 ack。

问题ack-grep: chars escaping与我的非常相似,但是为该问题提供和接受的解决方案对我不起作用。

PS C:\xampp\htdocs> ack abcd
<works as expected>
PS C:\xampp\htdocs> ack <
The redirection operator '<' is not supported yet.
At line:1 char:5
+ ack < <<<<
PS C:\xampp\htdocs> ack \<
The syntax of the command is incorrect.
PS C:\xampp\htdocs> ack '<'
The syntax of the command is incorrect.
PS C:\xampp\htdocs> ack '\<'
The syntax of the command is incorrect.
PS C:\xampp\htdocs> ack [<]
The system cannot find the file specified.
PS C:\xampp\htdocs> ack '[<]'
The system cannot find the file specified.
PS C:\xampp\htdocs> ack '[\<]'
The system cannot find the file specified.
PS C:\xampp\htdocs> ack \Q<\E
The system cannot find the file specified.
4

3 回答 3

5

Is there any reason you don't want to use PowerShell's regex search?

Select-String '<' *.*

## or
dir -r | Select-String '<'
于 2011-07-29T16:27:41.603 回答
0

PowerShell 中的转义字符是反引号:

PS C:\xampp\htdocs> ack `<
于 2011-07-29T08:24:47.963 回答
-1

你的意思是awk?如果是这样,那么您所要做的就是:$awk '/</ filename'

由于我没有安装 ack 我无法验证 100%,但我会试试这个代码:

ack  '<' --output '$1' -h

如果这不起作用,那么我建议您通读man ackack --help页面。

于 2011-07-29T07:10:10.607 回答