对于如下文本:
std_out_file: ${ALGO_TOP}/dynamic/batchlog/JS030003-ara.stop.badb.out
我希望输出为:
$BATCHLOG_DIR/JS030003-ara.stop.badb.out
这是代码:
nawk '/std_out_file:|std_err_file:/ { split($2, a, /); if ( a[3]=="batchlog" ) print "$$BATCHLOG_DIR/"$3; else print "$$CONSOLELOG_DIR/"$3; }'
我收到以下错误:
nawk: illegal primary in regular expression ); if ( a[3]=="batchlog" ) print "$$BATCHLOG_DIR at ; if ( a[3]=="batchlog" ) print "$$BATCHLOG_DIR
source line number 4
context is
/std_out_file:|std_err_file:/ { split($2, a, /); if ( a[3]=="batchlog" ) print "$$BATCHLOG_DIR/", $3; else print >>> " <<<
我哪里弄错了?