Sponsored Content
Top Forums Shell Programming and Scripting How to extract entire para instead of just line? Post 302908095 by reddyr on Thursday 3rd of July 2014 02:01:02 PM
Old 07-03-2014
Thanks Yoda and Scrutinizer.

@Yoda - Sorry your solution NOT working. It just prints System Information

Code:
# awk -v S="System Information" '
        {
                if ( $0 !~ /^ / )
                        T = $0
                if ( T )
                        A[T] = A[T] ? A[T] RS $0 : $0
        }
        END {
                for ( k in A )
                {
                        if ( A[k] ~ S )
                                print A[k]
        }       }
' /tmp/dmi_out
        System Information

@Scrutinzer - You are right. Actually I need to run dmidecode -t system which does NOT work on older RHEL 3 & 4 [ It works on RHEL 5.3 onwards ]. Hence Am trying to run just dmidecode and extract only the paragraph with "System Information".

-qt and -s options are also not working.

Please advise - thanks a lot!!

Last edited by reddyr; 07-03-2014 at 03:09 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Capture entire line in ps command

I need to determine what processes are running at certain times of the day. I have a script that issues the /usr/ucb/ps aux command and captures it to a file. I want to see the cpu usage and memory usage. This command lops off the end of the of the display line so I can't see the entire... (2 Replies)
Discussion started by: MizzGail
2 Replies

2. UNIX for Dummies Questions & Answers

grep entire statement not just line

(extract from SQL binlog file...) # at 4960 #080801 14:35:31 server id 4 end_log_pos 195 Query thread_id=63121426 exec_time=0 error_code=0 use d_jds; SET TIMESTAMP=1217581531; UPDATE bid_details set bidding = 3170.37 ,deduction=if((3170.37 < 37.43),0,deduction) where... (3 Replies)
Discussion started by: shantanuo
3 Replies

3. Shell Programming and Scripting

Print the entire line if second field has value P

Friends, I have .txt file with 3 millions of rows. File1.txt ABC1|A|ABCD1|XYZ1 ABC2|P|ABCD2|XYZ2 ABC3|A|ABCD3|XYZ3 ABC4|P|ABCD4|XYZ4 If second field has value P then print the entire line. Thanks in advance for your help, Prashant (4 Replies)
Discussion started by: ppat7046
4 Replies

4. Shell Programming and Scripting

Replace entire line

I want to replace one line from my configuration file with the new settings. The file Name: /etc/httpd/conf/httpd.conf The following line should be replaced with the line mentioned below. LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "\"%h\"... (3 Replies)
Discussion started by: shantanuo
3 Replies

5. UNIX for Dummies Questions & Answers

Show the entire line using ps

Using the vanilla ps -ef I noticed that the CMD (or command) line gets cut off after 90 characters UID PID PPID C STIME TTY TIME CMD root 6020 3822 0 Jun 19 ? 0:01 ./webservd-wdog -r /export/opt/sows/61sp4 -d /export/opt/sows/61sp4/https-logse Googling... (4 Replies)
Discussion started by: SixSigma1978
4 Replies

6. Shell Programming and Scripting

Script required to extract a specific snippet from the entire file.

Hi, I have a file with the following structure. XXXXX........... YYYYY........... ................. .................. ZZZZZZ...... qwerty_start.............. .................. ................. .................. querty_end................ .............................. (1 Reply)
Discussion started by: abinash
1 Replies

7. Shell Programming and Scripting

sed and awk to insert a line after a para

hi I am having a file like this ############################## mod1 ( a(ll) , b( c), try(o) , oll(ll) go(oo) , al(ll) mm(al) , lpo(kka) kka(oop) ); mod2 ( jj(ll) , c( kk), try1q(o1) , ofll(lll) gao(oo1) , ala(llaa) mmf(adl) , lddpo(kkad) kkda(oodp) );... (20 Replies)
Discussion started by: kshitij
20 Replies

8. Shell Programming and Scripting

Help with sed to replace entire line

Hi, I need to replace an entire mailx line as follows using sed: sed -e 's/<line1>/<newline>/g' <filename> But I am getting comman garbled error since the new line has many special characters. I enclosed allspecial chars in \ but still no use. Can any one help me? Please use code... (2 Replies)
Discussion started by: vinodhin4
2 Replies

9. Shell Programming and Scripting

Using the entire line with space in between

Hi Folks, I have a report data like the one seen below. FRUITS@NEW_ORANGE(1500 04/29) FRUITS@NEW_ORANGE(1500 05/04) FRUITS@NEW_ORANGE(1500 05/05) FRUITS@NEW_ORANGE(1500 05/07) FRUITS@NEW_ORANGE(1500 05/12) I need to use each of this lines separately in another for loop like the one... (2 Replies)
Discussion started by: jayadanabalan
2 Replies

10. Shell Programming and Scripting

How to extract entire stanza using awk?

Hello friends, I have a text file with lot of stanzas with each starting with "O-O-O. Sample file :- 1. d4 Nf6 2. c4 g6 3. Nc3 d5 4. cxd5 Nxd5 5. e4 Nxc3 6. bxc3 Bg7 7. Nf3 c5 8. Rb1 O-O 9. Be2 cxd4 10. cxd4 Qa5+ 11. Bd2 Qxa2 12. O-O Bg4 13. Bg5 h6 14. Be3 (8 Replies)
Discussion started by: prvnrk
8 Replies
DMIDECODE(8)						      System Manager's Manual						      DMIDECODE(8)

NAME
dmidecode - DMI table decoder SYNOPSIS
dmidecode [OPTIONS] DESCRIPTION
dmidecode is a tool for dumping a computer's DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system's hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware. While this is a good point in terms of report speed and safeness, this also makes the presented information possibly unreliable. The DMI table doesn't only describe what the system is currently made of, it also can report the possible evolutions (such as the fastest supported CPU or the maximal amount of memory supported). SMBIOS stands for System Management BIOS, while DMI stands for Desktop Management Interface. Both standards are tightly related and devel- oped by the DMTF (Desktop Management Task Force). As you run it, dmidecode will try to locate the DMI table. If it succeeds, it will then parse this table and display a list of records like this one: Handle 0x0002, DMI type 2, 8 bytes. Base Board Information Manufacturer: Intel Product Name: C440GX+ Version: 727281-001 Serial Number: INCY92700942 Each record has: o A handle. This is a unique identifier, which allows records to reference each other. For example, processor records usually reference cache memory records using their handles. o A type. The SMBIOS specification defines different types of elements a computer can be made of. In this example, the type is 2, which means that the record contains "Base Board Information". o A size. Each record has a 4-byte header (2 for the handle, 1 for the type, 1 for the size), the rest is used by the record data. This value doesn't take text strings into account (these are placed at the end of the record), so the actual length of the record may be (and is often) greater than the displayed value. o Decoded values. The information presented of course depends on the type of record. Here, we learn about the board's manufacturer, model, version and serial number. OPTIONS
-d, --dev-mem FILE Read memory from device FILE (default: /dev/mem) -q, --quiet Be less verbose. Unknown, inactive and OEM-specific entries are not displayed. Meta-data and handle references are hidden. -s, --string KEYWORD Only display the value of the DMI string identified by KEYWORD. KEYWORD must be a keyword from the following list: bios-vendor, bios-version, bios-release-date, system-manufacturer, system-product-name, system-version, system-serial-number, system-uuid, base- board-manufacturer, baseboard-product-name, baseboard-version, baseboard-serial-number, baseboard-asset-tag, chassis-manufacturer, chassis-type, chassis-version, chassis-serial-number, chassis-asset-tag, processor-family, processor-manufacturer, processor-ver- sion, processor-frequency. Each keyword corresponds to a given DMI type and a given offset within this entry type. Not all strings may be meaningful or even defined on all systems. Some keywords may return more than one result on some systems (e.g. proces- sor-version on a multi-processor system). If KEYWORD is not provided or not valid, a list of all valid keywords is printed and dmidecode exits with an error. This option cannot be used more than once. -t, --type TYPE Only display the entries of type TYPE. TYPE can be either a DMI type number, or a comma-separated list of type numbers, or a keyword from the following list: bios, system, baseboard, chassis, processor, memory, cache, connector, slot. Refer to the DMI TYPES section below for details. If this option is used more than once, the set of displayed entries will be the union of all the given types. If TYPE is not provided or not valid, a list of all valid keywords is printed and dmidecode exits with an error. -u, --dump Do not decode the entries, dump their contents as hexadecimal instead. Note that this is still a text output, no binary data will be thrown upon you. The strings attached to each entry are displayed as both hexadecimal and ASCII. This option is mainly useful for debugging. --dump-bin FILE Do not decode the entries, instead dump the DMI data to a file in binary form. The generated file is suitable to pass to --from-dump later. --from-dump FILE Read the DMI data from a binary file previously generated using --dump-bin. -h, --help Display usage information and exit -V, --version Display the version and exit Options --string, --type and --dump-bin determine the output format and are mutually exclusive. DMI TYPES
The SMBIOS specification defines the following DMI types: Type Information ---------------------------------------- 0 BIOS 1 System 2 Base Board 3 Chassis 4 Processor 5 Memory Controller 6 Memory Module 7 Cache 8 Port Connector 9 System Slots 10 On Board Devices 11 OEM Strings 12 System Configuration Options 13 BIOS Language 14 Group Associations 15 System Event Log 16 Physical Memory Array 17 Memory Device 18 32-bit Memory Error 19 Memory Array Mapped Address 20 Memory Device Mapped Address 21 Built-in Pointing Device 22 Portable Battery 23 System Reset 24 Hardware Security 25 System Power Controls 26 Voltage Probe 27 Cooling Device 28 Temperature Probe 29 Electrical Current Probe 30 Out-of-band Remote Access 31 Boot Integrity Services 32 System Boot 33 64-bit Memory Error 34 Management Device 35 Management Device Component 36 Management Device Threshold Data 37 Memory Channel 38 IPMI Device 39 Power Supply 40 Additional Information 41 Onboard Device Additionally, type 126 is used for disabled entries and type 127 is an end-of-table marker. Types 128 to 255 are for OEM-specific data. dmidecode will display these entries by default, but it can only decode them when the vendors have contributed documentation or code for them. Keywords can be used instead of type numbers with --type. Each keyword is equivalent to a list of type numbers: Keyword Types ------------------------------ bios 0, 13 system 1, 12, 15, 23, 32 baseboard 2, 10, 41 chassis 3 processor 4 memory 5, 6, 16, 17 cache 7 connector 8 slot 9 Keywords are matched case-insensitively. The following command lines are equivalent: o dmidecode --type 0 --type 13 o dmidecode --type 0,13 o dmidecode --type bios o dmidecode --type BIOS BINARY DUMP FILE FORMAT
The binary dump files generated by --dump-bin and read using --from-dump are formatted as follows: o The SMBIOS or DMI entry point is located at offset 0x00. It is crafted to hard-code the table address at offset 0x20. o The DMI table is located at offset 0x20. FILES
/dev/mem BUGS
More often than not, information contained in the DMI tables is inaccurate, incomplete or simply wrong. AUTHORS
Alan Cox, Jean Delvare SEE ALSO
biosdecode(8), mem(4), ownership(8), vpddecode(8) dmidecode November 2008 DMIDECODE(8)
All times are GMT -4. The time now is 12:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy