This is such a basic question in awk. But I am facing problems in this, and I do not know why. The problem is that I run the awk command on one line, for example
awk 'BEGIN {} {print $0;}' FILE
Then the code works flawlessly
But if I split the code between lines like
awk '
BEGIN
{
}
{
print $0;
}' FILE
This gives me a message that BEGIN should have a part of the action . I was wondering, since this is the same code that I format, why I get this error. It is really important for me to solve this problem, since I will write large lines of codes in awk, it will be difficult for me to format and cast them in one line every time. Could you help me with this. Thank. The note. I run this awk in a shell environment
source
share