由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - awk问题求救 (转载)
相关主题
HELP: 怎样用SCRIPT实现如下功能?请教:Variable in sed command
ls/mv/rm argument list too long error[转载] some body uses DBX?
DD weijing![转载] help: list private and global variables in perl
how to use a variable to represent interger which is bigger than 32768?how to automatically send email with attachments in Perl?
Re: how to use a variable to represent interger which is bigger than 3A Perl Question
[转载] How to remove an Environment variable on Solaris奇怪的 printf!! ksh programming
equivilent $REMOTEHOST in kshidb problem (转载)
How to set environment variables for CGI scripts?how to turn off sendmail
相关话题的讨论汇总
话题: testvar话题: awk话题: length话题: variable话题: illegal
进入Unix版参与讨论
1 (共1页)
xt
发帖数: 17532
1
【 以下文字转载自 Linux 讨论区 】
发信人: xt (拷贝猫), 信区: Linux
标 题: awk问题求救
发信站: BBS 未名空间站 (Sat Nov 17 18:13:38 2012, 美东)
今天恶补awk,写了这么个小程序
#!/bin/awk -f
BEGIN {
}
{
print "initLen=", length(testvar), "\n"
testvar[length(testvar) + 1]=1
testvar[length(testvar) + 2]=2
for (i = 1; i <= length(testvar); ++i) {
print "testvar[", i, "]=", testvar[i], "\n"
}
}
结果:
awk: test2.awk: line 7: illegal reference to variable testvar
awk: test2.awk: line 8: illegal reference to variable testvar
awk: test2.awk: line 10: illegal reference to variable testvar
请问为什么出错?
1 (共1页)
进入Unix版参与讨论
相关主题
how to turn off sendmailRe: how to use a variable to represent interger which is bigger than 3
Perl: conditionally match multiple lines[转载] How to remove an Environment variable on Solaris
sed question??equivilent $REMOTEHOST in ksh
A question for highhands..How to set environment variables for CGI scripts?
HELP: 怎样用SCRIPT实现如下功能?请教:Variable in sed command
ls/mv/rm argument list too long error[转载] some body uses DBX?
DD weijing![转载] help: list private and global variables in perl
how to use a variable to represent interger which is bigger than 32768?how to automatically send email with attachments in Perl?
相关话题的讨论汇总
话题: testvar话题: awk话题: length话题: variable话题: illegal