我有下面的脚本,但不知何故它给出了第7行的语法错误,如下所示。你能帮我解决这个问题。
./final.sh
awk: cmd. line:7: "|%-17s|%-16s|\r\n",id,$3 }
awk: cmd. line:7: ^ syntax error
#!/bin/sh
ipath=/usr/local/nextone/bin
date=$(date +"%Y%m%d%H%M")
ifile="$(date '+/var/tmp/EndpointUsage_%I-%M-%p_%d-%m-%Y.csv')"
"$ipath"/cli iedge list | awk '
BEGIN { print "|-----------------|------------------|";
printf "|%-17s|%-16s|\r\n","Registration ID", "Ongoing Calls"
}
/Registration ID/ { id = $3; next }
/Ongoing Calls/ {print "|-------------------|-----------------|"; printf
"|%-17s|%-16s|\r\n",id,$3 }
END{
print "|------------------|------------------|";
}'>> "$ifile"
在Etan更新后...但现在仍然在第6行得到同样的错误
awk: cmd. line:6: "|%-17s|%-16s|\r\n",id,$3 }
awk: cmd. line:6: ^ syntax error
#!/bin/sh
ipath=/usr/local/nextone/bin
date=$(date +"%Y%m%d%H%M")
ifile="$(date '+/var/tmp/EndpointUsage_%I-%M-%p_%d-%m-%Y.csv')"
"$ipath"/cli iedge list | awk '
BEGIN { print "|-----------------|------------------|";
printf "|%-17s|%-16s|\r\n","Registration ID", "Ongoing Calls"}
/Registration ID/ { id = $3; next }
/Ongoing Calls/ {print "|-------------------|-----------------|"; printf
"|%-17s|%-16s|\r\n",id,$3 }
END{
print "|------------------|------------------|";
}'>> "$ifile"