I have a file called temp1
sCellEventTrap-03-27 TRAP-TYPE -- CAC Code: 01 ENTERPRISE compaq VARIABLES { scellNameDateTime, scellSWComponent, scellECode, scellCAC, scellEIP} DESCRIPTION "Severity: Critical -- failure or failure imminent. A physical disk drive has experienced an ID block inconsistency." --#TYPE "StorageCell Event" --#SUMMARY "SCellName-TimeDate %s : SWCID %d : ECode: %d : CAC %d : EIP %d." --#ARGUMENTS {0,1,2,3,4,} --#SEVERITY CRITICAL --#TIMEINDEX 136 --#STATE WARNING ::= 13600807
Applying this on temp1
prvar=$(awk '/VARIABLES/,/DESCRIPTION/ {gsub("VARIABLES"," "); gsub("DESCRIPTION"," "); gsub("}"," "); gsub("{"," ");gsub(","," ");print;print ":%s"}' temp1)
Gives me (what I want)
echo $prvar scellNameDateTime :%s scellSWComponent :%s scellECode :%s scellCAC :%s scellEIP :%s :%s
However this (the format not wanted)
echo "$prvar" scellNameDateTime :%s scellSWComponent :%s scellECode :%s scellCAC :%s scellEIP :%s :%s
I am to use prvar
in echo
along with text like this
echo "blah blah blah $prvar"
Doing this what I get
blah blah blah scellNameDateTime :%s scellSWComponent :%s scellECode :%s scellCAC :%s scellEIP :%s :%s
What I want it to print
blah blah blah scellNameDateTime :%s scellSWComponent :%s scellECode :%s scellCAC :%s scellEIP :%s :%s
The ""
on the prvar when using echo
create the problem. What can I do so that prvar is printed in a just above format?
EDIT
Well turns out it doesnt make a difference whatever I type in my SCRIPT echo "$prvar"
and echo $prvar
print the same thing --- the format i don't want. The Terminal and the script are behaving differently. Any work around for this?