This is such a basic question in awk . But I am facing issues in this and I dont know why. problem is when I run the awk command in a single line such as
awk 'BEGIN {} {print $0;}' FILE
Then the code is running perfecctly
But if I split the code between lines such as
awk '
BEGIN
{
}
{
print $0;
}' FILE
It gives me an error stating that BEGIN should have an action part . I was wondering since it is the same code that I am formatting, why am I getting this error. Its really important for me to solve this as I would be writting large lines of codes in awk it would be difficult for me to format and bring it in a single line everytime. Could you ppl please help me regarding this. Thank you. Note. I am running this awk in shell environment