perl 调用 awk printf 双引号冲突
调用方式:
ps -eo etime,pid,comm | grep java | awk -F' ' '{ if(length(\$1)>=10) printf "%011s,%s\n",\$1,\$2; else if(length(\$1)>5) printf "00-%08s,%s\n",\$1,\$2;else printf "00-00:%s,%s\n",\$1,\$2; }' > $tmpfile
;
报错:
awk: { if(length($1)>=10) printf "%011s,%s
awk: ^ unterminated string
1
jiefoxi 2016-01-11 11:57:22 +08:00 via Android
换行符 \n 还需要转义
|