开发者

problem in scripting

when I am executing this on the command line:

awk 'BEGIN{OFS=FS=","}$3~/^353/{print}' axeM10_20110510100219_59.DAT_353 >log

it executes vey nicely without taking much time and instantly gives me the output file.

but when I am including this in a shell script :

#!/usr/bin/ksh

for i in *.DAT_353
do
awk 'BEGIN{OFS=FS=","}$3~/^353/{print}'  ${i} > ${i}_changed >/dev/null
done

exit

the script is gene开发者_运维百科rating a 0 byte files. may I know what is the problem here?


Remove >/dev/null because that is where your stdout is being redirected to.


Just like Dogbane pointed out, > redirects the standard output by default. Hence there is no need to forcefully redirect it . Here is a link to more of the redirection tricksStandard Input and Output Redirection

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜