this may be basic thing for everyone here, but i cant push awk to print the variable user input which is INS, please help.
code:
INS=$1
printf '\n'
symdg list | grep $INS-clone | awk -v i=$INS '{ID=substr($4,9,4)}{print "Device Group: "$1,"at Array "ID,i}'
output:
$ ./test.sh patty
awk: syntax error near line 1
awk: bailing out near line 1
it worked, thanks! what would be difference / specific application wherein nawk is better than awk??
pamu
4
Are you using Solaris..?
As per my findings /usr/pkg4/bin/awk and nawk used in Solaris..
please do let me correct if i am wrong. not familiar with Solaris..
You could also put variables into awk the old-fashioned way:
awk '{...}' VARNAME="$VAR"
You really should be double-quoting all your shell variables, by the way.
Also, if you're using awk, you really don't need grep.
symdg list | awk '$0 ~ I"-clone" { ID=substr($4,9,4); print "Device Group: "$1,"at Array "ID,I}' I="$INS"