[wplug] Looking for scripting help to parse information

Eric Cooper ecc at cmu.edu
Fri Mar 14 09:26:09 EST 2008


On Fri, Mar 14, 2008 at 09:19:14AM -0400, Rob Lines wrote:
> I am trying to get some information from the ipmitool specifically
> the temperature readings for the CPUs and the ambient temperature.
> I can run the command and it gives me the 3 values on separate
> lines.
[...]
> But they always show up in the same order so what I would like to do
> is have a way to grab a specific line and save that into a variable.
> I am sure there is a simple way to do this I am just not sure where
> to look for it.  I would prefer to avoid using perl and just stick
> to shell scripting if possible.

In bash,
    { read line1; read line2; read line3 } < <(ipmi args ...)
should give you the three lines of ipmi output in shell vars line1,
line2, and line3.

-- 
Eric Cooper             e c c @ c m u . e d u


More information about the wplug mailing list