in the continuation of this, Awk doesn't match all match all my entries, I am now trying to write a script to execute this on different machine. In the script, I want to run /usr/xpg4/bin/awk if it exists else regular awk. I can't do just a simple if else because my script is too complex - I wan't to do something user friendly and it has some options. So I record the proper awk in a variable like this :
command='awk '"'"'match($0,/^[[:alpha:]_][[:alnum:]_]*\**[[:space:]]+[[:alpha:]_][[:alnum:]_]*[[:space:]]*\([^)]*\)/) { print substr($0,RSTART,RLENGTH) ";\n" }'"'";
after what I try to execute it
code=$($command $file);
I get this error :
awk: command line:1: 'match($0,/^[[:alpha:]_][[:alnum:]_]*\**[[:space:]]+[[:alpha:]_][[:alnum:]_]*[[:space:]]*\([^)]*\)/)
awk: command line:1: ^ bad character « ' » in expression
It doesn't mean anything if I take them off...