here the script that i am calling is someScript.sh and to that i want to pass the contents of alDFid , i itred giving it in quotes , $ but none of it worked. even tried printf "%s",alDFid even this is not working.
Does anyone know how to pass argument to script from Awk with awk variable??
ALSO
why does
awk -F'priority=' '{print $2}' | cut -d'"' -f2
inside cmd="" wont work.. it wont consider awk inside this command. it keeps throwing error as
| grep priority | awk -Fpriority= {print
awk: cmd. line:6: ^ unterminated string
./alertCheck_vivek.sh_date: line 26: cmd: command not found
./alertCheck_vivek.sh_date: line 26: getline: command not found
./alertCheck_vivek.sh_date: line 27: print: command not found
./alertCheck_vivek.sh_date: line 28: syntax error near unexpected token `cmd'
./alertCheck_vivek.sh_date: line 28: `close(cmd)'
Your idea is correct, but as your code is absolutely unreadable, I only can guess that the variable alDFid is undefined when used to build the external command.
And, of course, you have an unterminated string, i.e. one unmatched double quote (I guess in the printf statement)
awk: cmd. line:6: cmd="sh /opt/hqe/hqapi1-client-5.0.0/bin/hqapi.sh alertdefinition list --id=$myAlertDefID --host=localhost --port=7443 --user=hqadmin --password=hqadmin --secure=true | grep priority | awk -Fpriority= {print
awk: cmd. line:6: ^ unterminated string
./alertCheck_vivek.sh_date: line 26: cmd: command not found
./alertCheck_vivek.sh_date: line 26: getline: command not found
./alertCheck_vivek.sh_date: line 27: print: command not found
./alertCheck_vivek.sh_date: line 28: syntax error near unexpected token `cmd'
./alertCheck_vivek.sh_date: line 28: `close(cmd)'
lets forget about that... the alDFid is defined below is the output