Zenet
Zenet

Reputation: 7401

problem with awk script

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

sam@sam-laptop:~/shell/td4$ awk -f agenda.awk -- -n Robert agenda.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

Upvotes: 1

Views: 278

Answers (2)

alvin
alvin

Reputation: 1196

i think you also need to modify the shebang as

#!/usr/bin/awk -f

Upvotes: 0

Seaux
Seaux

Reputation: 3517

you need to wrap it in {}


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

Upvotes: 4

Related Questions