【发布时间】:2014-06-24 17:55:45
【问题描述】:
我在一个文件中有以下几行
lines="188"
lines="24"
lines="25"
然后我提取引号(“”)内的值,并使用以下命令将这些值相加得到 237
awk -F'\"' '{count+=$2;}END{if(count>0) print count;else print 0}'
但是,我想将输出重定向到文本文件。我尝试使用重定向操作 (>) 运算符,但它一直给我错误
这是我目前所拥有的
awk -F'\"' '{count+=$2;}END{if(count>0) print count;else print 0}' > "sum.txt"
这就是错误
fatal: cannot open file '>' for reading (No such file or directory)
【问题讨论】:
-
"I tried using the redirect operation (>) operator"显示你尝试了什么。 -
你给文件名了吗?
标签: windows command-line awk command-line-arguments gawk