我if else
在awk
. 每次我使用它时都会遇到语法错误。谁能告诉我如何使用这个?我收到如下所示的语法错误。
代码:
awk '{ FS = "=" ;if($1 ~ /Hi/) {if (!($1=="Hi")) {print $1;}} else {if($1=="bye") {print $1;}}} else {if(if($1=="good") {print $1;}}} END {print $1}'
输出:
awk: { FS = "=" ;if($1 ~ /Hi/) {if (!($1=="Hi")) {print $1;}} else {if($1=="bye") {print $1;}}} else {if(if($1=="good") {print $1;}}} END {print $1}
awk: ^ syntax error
awk: { FS = "=" ;if($1 ~ /Hi/) {if (!($1=="Hi")) {print $1;}} else {if($1=="bye") {print $1;}}} else {if(if($1=="good") {print $1;}}} END {print $1}
awk: ^ syntax error
awk: { FS = "=" ;if($1 ~ /Hi/) {if (!($1=="Hi")) {print $1;}} else {if($1=="bye") {print $1;}}} else {if(if($1=="good") {print $1;}}} END {print $1}
awk: ^ syntax error