Recently, I am learning awk. I found that the result I get using BEGIN{}
is quite unexpected to me. Let's see this example below:
1. echo "Create" | awk 'IGNORECASE = 1;/create/;' this would print out `Create` :
2. echo "Create" | awk 'BEGIN{IGNORECASE = 1};/create/;' returns nothing
As fas as I know, BEGIN{}
means:
Awk will execute the action(s) specified in BEGIN once before any input lines are read.
I would like to know why the second command returns nothing.