Sponsored Content
Top Forums Shell Programming and Scripting Getting values from a block into variables Post 302372156 by rethink on Tuesday 17th of November 2009 07:22:58 AM
Old 11-17-2009
Getting values from a block into variables

Hi there, If I run "ipmitool bmc info" on any of my x86 boxes, i get

Code:
Device ID                 : 32
Device Revision           : 1
Firmware Revision         : 1.1
IPMI Version              : 2.0
Manufacturer ID           : 42
Manufacturer Name         : Sun Microsystems
Product ID                : 18177 (0x4701)
Device Available          : yes
Provides Device SDRs      : no
Additional Device Support :
    Sensor Device
    SDR Repository Device
    SEL Device
    FRU Inventory Device
    IPMB Event Receiver
    IPMB Event Generator
    Chassis Device
Aux Firmware Rev Info     : 
    0x08
    0x00
    0x00
    0x00

Im trying to figure out a way of getting the four values directly underneath the string "Aux Firmware Rev Info :" into their own variables as i need to evaluate each of them to get the overall firmware revision


Does anybody have any idea how i would get these 4 values (and there are always 4) into variables? would i have to put them in some sort of array.

any help or guidance on this would be greatly appreciated

PS: I can technically do this by doing a "tail -4 | head -1" operation, then a "tail -3 | head -1" etc etc ....but im assuming there is a more stable and effective way of doing this
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parsing and getting values of variables

suppose i have a file value where it returns 3 values a=1 b=2 c=4 when i run it. i am using this file in my shell script. how do i parse and get the value of a b and c? (3 Replies)
Discussion started by: Rekha
3 Replies

2. Shell Programming and Scripting

how to access values of awk/nawk variables outside the awk/nawk block?

i'm new to shell scripting and have a problem please help me in the script i have a nawk block which has a variable count nawk{ . . . count=count+1 print count } now i want to access the value of the count variable outside the awk block,like.. s=`expr count / m` (m is... (5 Replies)
Discussion started by: saniya
5 Replies

3. Shell Programming and Scripting

Assign values to variables of a file

Hi, I have a file like the following... CUST= DIR= NULIST= name=philps_123 How can i add values to each of these unassigned variables using a shell script? say for eg: i have values for CUST as onida, dir as /dir/onida, NULIST as /tmp/onida_files. How can i add these values to... (11 Replies)
Discussion started by: Tuxidow
11 Replies

4. Shell Programming and Scripting

How to use values in variables

Hi Legends, Please help me in solving the below: I have the file size and file name using `ls` and awk command. ls -ltr *.pf |awk '{print $5, $9}' 2000003072 ABC.pf 2000003072 DEF.pf 2000003072 GHI.pf 56000588 JKL.pf 2000003072 MNO.pf 2000003072 PQR.pf Now, I want to take the... (3 Replies)
Discussion started by: sdosanjh
3 Replies

5. Shell Programming and Scripting

Help in assigning values to variables from the file

Hi! This might be a simple thing, but I'm struggling to assign values to variables from the file. I've the following values stored in the file.. It consists of only two rows.. 10 20 I want to assign the first row value to variable "n1" and the second row value to variable "n2".. That is ... (3 Replies)
Discussion started by: abk07
3 Replies

6. Shell Programming and Scripting

Exporting Values of Variables to Another File

Hello, I'm very new to Linux, and I have a question, I'm hoping you could help me with. :) I have created a file called subject, contains this code: #!/bin/bash read -p "Student Name: " NAME read -p "Student ID: " ID read -p "Address: " ADDRESS I'm to create another file called... (7 Replies)
Discussion started by: iwant2learn
7 Replies

7. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

8. Shell Programming and Scripting

Get values block by block in same file

I have a file say "SAMPLE.txt" with following content, P1 10,9:6/123456 P2 blah blah P1 10,9:5/98765 P2 blah blah P1 blah blah P2 I want a output file say "RESULT.txt" as, Value1:123456 Value2:98765 Value3:NULL (17 Replies)
Discussion started by: garvit184
17 Replies

9. Shell Programming and Scripting

A better way to assign values to variables - shell

so i've been used to doing it this way: SVAL=$(echo "7 3 2 38 3" | awk '{print $2}') 4VAL=$(echo "4:21:N:3" | awk -F":" '{print $4}') I know there's a way to do it by putting the value in an array and assigning it that way. but i'm not sure how to do it efficiently. any ideas? i dont... (9 Replies)
Discussion started by: SkySmart
9 Replies

10. Shell Programming and Scripting

Extract multiple values into corresponding variables

Here is my input # MANIFEST.MF Manifest-Version: 1.0 Build-Jdk: 1.6.0 Built-By: CM_TEAM Build_SvnRev: 662789 Build_Number: 13.0.0.0-JDK8 Build_Date: Wed 04/05/2017-20:48:19.17 Archiver-Version: Plexus Archiver Created-By: Apache Maven 3.1.0 Here is the expected output:... (4 Replies)
Discussion started by: kchinnam
4 Replies
Device::USB::PCSensor::HidTEMPer::Device(3pm)		User Contributed Perl Documentation	     Device::USB::PCSensor::HidTEMPer::Device(3pm)

       Device::USB::PCSensor::HidTEMPer::Device - Generic device class

VERSION
Version 0.02 SYNOPSIS
None DESCRIPTION
This module contains a generic class that all HidTEMPer devices should inherit from, thereby keeping the implemented methods consistent and making it possible to use the same code to contact every supported device. CONSTANTS o CONNECTION_TIMEOUT USB communication timeout, specified in milliseconds. METHODS o new( $usb_device ) Creates a new generic Device object. o identifier() This method is used to acquire the numerical value representing the device type identifier. o internal() Returns the corresponding Sensor object representing the internal sensor connected to the device. If the device does not have an internal sensor undef is returned. o external() Returns the corresponding Sensor object representing the external sensor connected to the device. If the device does not have an external sensor undef is returned. o init() Empty method that should be implemented in order to be able to initialize a object instance. DEPENDENCIES
This module internally includes and takes use of the following packages: use Carp; use Device::USB; use Device::USB::Device; This module uses the strict and warning pragmas. BUGS
Please report any bugs or missing features using the CPAN RT tool. FOR MORE INFORMATION
None AUTHOR
Magnus Sulland < msulland@cpan.org > ACKNOWLEDGEMENTS
None COPYRIGHT &; LICENSE Copyright (c) 2010 Magnus Sulland This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-07-24 Device::USB::PCSensor::HidTEMPer::Device(3pm)
All times are GMT -4. The time now is 02:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy