I am trying to access a shell variable inside a piped nawk. I have never done this before and was wondering if its possible.
Here is the command sbdadm list-lu
contents:
Found 2 LU(s)
GUID DATA SIZE SOURCE
600144f029bf0a0000004e0484740052 107380964864 /dev/rdsk/c9d0s1 600144f029bf0a0000004e0484740053 53694562304 /dev/rdsk/c9d0s3
Here is my sample of my script :
DISK=/dev/rdsk/c9d0s3
sbdadm list-lu |nawk '/$DISK/ {print}'
NOTE: I know the " /$DISK/
" syntax will not work since $ is part of a regex symbol.
I need the right syntax if such a code is ever possible.
In addition,does awk spawn another shell?
If so, is it possible that I can export this variable $DISK
to that shell.