I have this store in a variable
sCellEventTrap-03-28 TRAP-TYPE -- CAC Code: 00 ENTERPRISE compaq VARIABLES { scellNameDateTime, scellSWComponent, scellECode, scellCAC, scellEIP} DESCRIPTION "Severity: Normal -- informational in nature. A physical disk drive has experienced an ID block inconsistency during a periodic drive check." --#TYPE "StorageCell Event" --#SUMMARY "SCellName-TimeDate %s : SWCID %d : ECode: %d : CAC %d : EIP %d." --#ARGUMENTS {0,1,2,3,4,} --#SEVERITY INFORMATIONAL --#TIMEINDEX 136 --#STATE WARNING ::= 13600808
I am to cut everything till second occurrence of "
. So that would give me:
sCellEventTrap-03-28 TRAP-TYPE -- CAC Code: 00 ENTERPRISE compaq VARIABLES { scellNameDateTime, scellSWComponent, scellECode, scellCAC, scellEIP} DESCRIPTION "Severity: Normal -- informational in nature. A physical disk drive has experienced an ID block inconsistency during a periodic drive check."
Another Example
genericSanEvent TRAP-TYPE ENTERPRISE hpSanManager VARIABLES { severityLevel, category, id, msgString, contactName, contactEmail, contactWorkPhone, contactHomePhone, contactPager, contactFax } DESCRIPTION "A generic SAN event has occurred. The variables are: severityLevel - the event severity level; category - Category of the event being reported; code - ID of the event in the given category; msgString - the message string describing the event; contactName - the name of the individual to be notified of the event; contactEmail - the e-mail address of the individual referred to in contactName; contactWorkPhone - the work phone number of the individual referred to in contactName; contactHomePhone - the home phone number of the individual referred to in contactName; contactPager - the pager number of the individual referred to in contactName; contactFax - the FAX number of the individual referred to in contactName" -- The following are attributes used by xnmloadmib for improved formatting --#TYPE "OV SAM SAN Event" --#SUMMARY "OV SAM SAN Event, Category/Id: %d/%d, Msg: %d Severity: %d Contact: %d" --#ARGUMENTS {1,2,3,0,4} --#SEVERITY CRITICAL --#GENERIC 6 --#CATEGORY "Application Alert Events" --#SOURCE_ID "T" ::= 1
Output for this example should be :
genericSanEvent TRAP-TYPE ENTERPRISE hpSanManager VARIABLES { severityLevel, category, id, msgString, contactName, contactEmail, contactWorkPhone, contactHomePhone, contactPager, contactFax } DESCRIPTION "A generic SAN event has occurred. The variables are: severityLevel - the event severity level; category - Category of the event being reported; code - ID of the event in the given category; msgString - the message string describing the event; contactName - the name of the individual to be notified of the event; contactEmail - the e-mail address of the individual referred to in contactName; contactWorkPhone - the work phone number of the individual referred to in contactName; contactHomePhone - the home phone number of the individual referred to in contactName; contactPager - the pager number of the individual referred to in contactName; contactFax - the FAX number of the individual referred to in contactName"
sed 's/"[^"]*$//'
but what it does is it only deletes the"
and nothing after that. So the whole thing remains only a"
is deleted.awk -F ""\" '{print $1 (NF>1? FS $2 : "")}' temp1
but the same thing as above happens.