grep和awk的Windows中的无效字符在Ex pression错误 [英] Grep and Awk in Windows Invalid Char in Expression Error
问题描述
我是新来的grep和awk - 使用Windows 7(我下载的grep和awk for Windows的GnuWin)
I am new to grep and awk - using Windows 7 (I downloaded grep and awk for windows from GnuWin).
我有遇到麻烦运行此脚本:
I am have having trouble running this script:
grep -Fwf dictionary.txt frequency.txt | awk '{print $2 "," $1}'
我得到的错误:
AWK:{打印结果
AWK:防爆$ P $ ^ pssion字符无效'''
I get the error:
awk: '{print
awk: ^ invalid char ''' in expression
我认为它可能有一些做具有在Windows中使用双引号,但我尝试了所有我能想到的组合,仍然不起作用。
I believe it might have something to do with having to use double quotes in Windows, but I tried all the combinations I can think of and still it doesn't work.
谁能帮助?
谢谢
Can anyone help? Thanks
推荐答案
避灾命令行项目始终是在Windows上的痛苦。正如你可能可以使用最后一招的gawk -f
!
Escaping command line items is always a pain on Windows. As a last resort you could probably use gawk -f
!
所以:你的文件 script.awk
包含:
print $2,$1
和你做的grep -Fwf dictionary.txt frequency.txt | AWK -f script.awk
这篇关于grep和awk的Windows中的无效字符在Ex pression错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!