I have this command
Here
vovar=OBJECTS prvar="$(awk '/'"$vovar"'/,/}/ {gsub("$vovar"," "); gsub("}",": %s,"); gsub("{"," ");gsub(",",": %s,");print}' temp1)"
Contents of temp1
ciscoFlashCopyCompletionTrap NOTIFICATION-TYPE OBJECTS { ciscoFlashCopyStatus } STATUS current DESCRIPTION "A ciscoFlashCopyCompletionTrap is sent at the completion of a flash copy operation if such a trap was requested when the operation was initiated. " ::= { ciscoFlashMIBTraps 1 }
What I want the command to do
ciscoFlashCopyStatus : %s: %s,
What it actually does
OBJECTS ciscoFlashCopyStatus : %s: %s,
How can I change my awk command so that I can get what I want?
Best Answer
You used
vovar
outside single quotes for the first time, but not the second time:If you'd been consistent: