开发者

problem with awk script

开发者 https://www.devze.com 2022-12-23 00:00 出处:网络
when I call my awk script, I keep getting an error : sam@sam-laptop:~/shell/td4$ awk -f agenda.awk -- -n Robert a开发者_运维问答genda.txt

when I call my awk script, I keep getting an error :

sam@sam-laptop:~/shell/td4$ awk -f agenda.awk -- -n Robert a开发者_运维问答genda.txt
awk: agenda.awk:6: printf "Hello"
awk: agenda.awk:6: ^ syntax error

the script contains this :

#!/usr/bin/awk
BEGIN {
}

printf "Hello"

END {
}

Thank you


you need to wrap it in {}


BEGIN {
}
{
 printf "Hello"
}
END {
}


i think you also need to modify the shebang as

#!/usr/bin/awk -f
0

精彩评论

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