求教foreach的问题

求教foreach的问题

把文件indata0[1-5].txt里的内容复制到outdata0[1-5].txt里
只复制每行前3个域,并且包含字符串abc的内容
分隔符由\转为,
我想用awk来完成一个后用foreach来做循环
请高手帮我看看哪里错了,为什么无法执行?

#!/usr/bin/csh
set ff = indata0[1-5].txt
foreach file ($ff)
awk 'BEGIN{FS="\\";OFS=","}
$1" "$2" "$3~/abc/{sub(/in/,"out",FILENAME);print$1,$2,$3>FILENAME}' $file
end      
i know little about c shell but why c shell? bash is much better than c shell.