scripting help

Steven W. Orr steveo at syslang.net
Sat Sep 30 02:30:45 UTC 2006


On Friday, Sep 29th 2006 at 23:11 +0300, quoth peter kostov:

=>On Fri, 2006-09-29 at 14:08 -0400, Steven W. Orr wrote:
=>> On Friday, Sep 29th 2006 at 16:59 +0100, quoth Tom Brown:
=>> 
=>> =>Hi
=>> =>
=>> =>I have a script and the output of that script is currently
=>> =>
=>> =>UCD-SNMP-MIB::ucdavis.55.101.1 = STRING: "CRITICAL emcpowera, 2 dead, 2 alive,
=>> =>possible LUN tresspass or HBA failure"
=>> =>
=>> =>is there anyway to cut off the text '
=>> =>UCD-SNMP-MIB::ucdavis.55.101.1 = STRING: '
=>> =>
=>> =>so that i get whatever comes AFTER that ?
=>> =>
=>> =>thanks
=>> 
=>> You're probably going to get some youngh whippersnapper who has a solution 
=>> which will involve conspicuous resource consumption, like the use of sed.
=>> 
=>> 
=>> foo==>'UCD-SNMP-MIB::ucdavis.55.101.1 = STRING: "CRITICAL emcpowera, 2 dead, 2 alive, possible LUN tresspass or HBA failure"'
=>> echo ${foo#*STRING}
=>> 
=>> :-)
=>> 
=>Hi Steven! You are right about sed - it is a wonderful program, but
=>really CPU intensive. But that you posted doesn't work when copied
=>exactly, however this
=> foo='UCD-SNMP-MIB::ucdavis.55.101.1 = STRING: "CRITICAL emcpowera, 2 dead, 2 alive, possible LUN tresspass or HBA failure"'
=> echo ${foo#*STRING:}
=>works as Tom wants. I don't quite understand this, but it is interesting
=>approach. Could you explain it a little bit more, or point me to a link
=>where I can read more!
=>
=>Best regards,
=>
=>Peter

man bash

Read the section on Parameter Expansion

Sorry about the extra=>
It was the result of a bad hack'n'wack




More information about the fedora-list mailing list