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

PowerShell の正規表現検索を使用したくない理由はありますか?

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 ackと のack --helpページを読むことをお勧めします。

于 2011-07-29T07:10:10.607 に答える