I have an instruction awk:
glb_library="my_library"
awk "
/^Direct Dependers of/ { next }
/^---/ { next }
/^$glb_library:/ { ver=\$0; next }
{ gsub(/[[:space:]]/, '', \$0); print ver':'\$0 }
" file
Basically, I enclosed the code awkin double quotes, so the shell variable glb_libraryexpands. I am sure to avoid the character $to prevent shell expansion $0. Following the directions here .
awk gives me this error:
awk: syntax error at source line 5
context is
{ gsub(/[[:space:]]/, >>> ' <<<
I want to understand:
- Is it possible to use single quotes inside
awk? Why ''not an empty string, for example ""? - Does
awksingle and double quotes separate ?
My code worked after I escaped single quotes with \"\"backslashes and used to represent a null string instead ''.