Hi All,

I need to parse the out from following output:

I need to get the adapter detail after the heading "System Adapter Configuration:"

This adapter detail is in 2nd cloumn like ACPI_IA64_P, ACPI_IA64_B, XBUS and PCI. I have marked the desired output in RED color.

Please help me in this issue. I bugged myself like anything to do this, Thanks for your input.


System Configuration:
---------------------
System Information:
System Type HP rx2600 (1.30GHz/3.0MB) Primary CPU ID 0.
Cycle Time 0.77 nsec (1300 MHz) Pagesize 8192 Byte

System Management BIOS Information:
BIOS Version 02.31 Manufacturer hp
Release Date 03/11/2004 Product Name server rx2600
SMBIOS Table 00000000.3FB3A020 Serial Number US51082292
UUID 5E4A99BF.C698599F.11D9A6B3.A0C8495F

System Memory Configuration:
----------------------------
Cluster PFN Start PFN Count Range (MByte) Usage
-------- ------------ ------------ ----------------------------- -------
#000 0 1 0.0 MB - 0.0 MB Console
#001 1 79 0.0 MB - 0.6 MB System
80 48 NXM
#002 128 384 0.6 MB - 3.6 MB System
#003 512 256 3.6 MB - 5.6 MB Console
#004 768 256 5.6 MB - 7.6 MB System
#005 1024 256 7.6 MB - 9.6 MB Console
#006 1280 6912 9.6 MB - 63.6 MB System
#007 8192 2048 63.6 MB - 79.6 MB Console
#008 10240 8256 79.6 MB - 144.1 MB System
18496 1 NXM
#009 18497 2416 144.1 MB - 163.0 MB System
20913 1 NXM
#010 20914 3 163.0 MB - 163.0 MB System
20917 2 NXM
#011 20919 1 163.0 MB - 163.0 MB System
20920 1 NXM
#012 20921 3908 163.0 MB - 193.6 MB System
24829 1 NXM
#013 24830 7938 193.6 MB - 255.6 MB System
#014 32768 2048 255.6 MB - 271.6 MB Console
#015 34816 94798 271.6 MB - 1012.2 MB System
#016 129614 622 1012.2 MB - 1017.0 MB Console
#017 130236 1 1017.0 MB - 1017.1 MB System
130237 1 NXM
#018 130238 5 1017.1 MB - 1017.1 MB System
130243 1 NXM
#019 130244 1 1017.1 MB - 1017.1 MB System
130245 1 NXM
#020 130246 2 1017.1 MB - 1017.1 MB System
130248 1 NXM
#021 130249 9 1017.1 MB - 1017.2 MB System
130258 2 NXM
#022 130260 140 1017.2 MB - 1018.3 MB System
#023 130400 32 1018.3 MB - 1018.5 MB Console
#024 130432 7 1018.5 MB - 1018.6 MB System
#025 130439 633 1018.6 MB - 1023.5 MB Console
131072 33554432 NXM
#026 33685504 128842 1023.5 MB - 2030.1 MB System
#027 33814346 181 2030.1 MB - 2031.5 MB Console
#028 33814527 295 2031.5 MB - 2033.8 MB System
#029 33814822 1 2033.8 MB - 2033.8 MB Console
#030 33814823 1 2033.8 MB - 2033.8 MB System
#031 33814824 2 2033.8 MB - 2033.9 MB Console
#032 33814826 1 2033.9 MB - 2033.9 MB System
#033 33814827 726 2033.9 MB - 2039.5 MB Console
#034 33815553 252 2039.5 MB - 2041.5 MB Console
#035 33815805 2 2041.5 MB - 2041.5 MB Console
#036 33815807 359 2041.5 MB - 2044.3 MB System
#037 33816166 153 2044.3 MB - 2045.5 MB Console
#038 33816319 9 2045.5 MB - 2045.6 MB System
#039 33816328 55 2045.6 MB - 2046.0 MB Console
#040 33816383 108 2046.0 MB - 2046.9 MB System
#041 33816491 85 2046.9 MB - 2047.5 MB Console

System Processor Configuration:
-------------------------------
CPU ID 0 CPU State rc,pa,pp,cv,pv,pmv,pl
CPU Type Itanium (Madison Rev B1)
Halt PC 00000000.00000000 Halt PS 00000000.00000000
Halt code Bootstrap or Powerfail Halt Req. Default, No Action
Slot VA FFFFFFFF.90177000 CPUDB VA FFFFFFFF.8801C000
Package 0 Core 0
Thread id 0 Cothread id None
FW Usage 00000000.00000000 CPU die 0
ACPI CPU id 00000000.00000000 Serial Num 000061091c8e035b
LID 00000000.00000000 CFG flags 00000000.00000631 Hardwar
e Initialized Primary Present Reassignable

CPU ID 1 CPU State rc,pa,pp,cv,pv,pmv,pl
CPU Type Itanium (Madison Rev B1)
Halt PC 00000000.00000000 Halt PS 00000000.00000000
Halt code Bootstrap or Powerfail Halt Req. Default, No Action
Slot VA FFFFFFFF.90178000 CPUDB VA FFFFFFFF.880D0980
Package 1 Core 0
Thread id 0 Cothread id None
FW Usage 00000000.00010000 CPU die 0
ACPI CPU id 00000000.00000001 Serial Num 00029fe1cf22f845
LID 00000000.01000000 CFG flags 00000000.00000611 Hardwar
e Initialized Present Reassignable


System Adapter Configuration:
-----------------------------
TR Adapter ADP Hose Bus BusArrayEntry Node GSIN iVe
c SCB Port Slot Device Name / HW-Id
-- ----------- ----------------- ---- -------------------------- ---- ----------
--------- ---- ---- ---------------------------
1 ACPI_IA64_P FFFFFFFF.8807B800 0 00 IA64_BUS
2 ACPI_IA64_B FFFFFFFF.88087EC0 0 00 IA64_BUS
3 XBUS FFFFFFFF.88099640 0 00 XBUS
FFFFFFFF.88099918 0 0000 FF
FF 0 CMA: 0 IPMI port
FFFFFFFF.88099A28 1 0023 00
DE 15E0 TTA: 1 Generic Com port
FFFFFFFF.88099B38 2 0022 00
DD 15D0 TTB: 2 Generic Com port
FFFFFFFF.88099C48 3 0024 00
DC 15C0 SEA: 3 ACPI System Event
4 PCI FFFFFFFF.8809EC40 0 00 PCI
FFFFFFFF.8809F028 8 FFFF FF
FF 0 1 MFPCI
FFFFFFFF.8809F138 10 0015 00
DB 15B0 DQA: 2 CMD 649 IDE/ATA Controller
FFFFFFFF.8809F248 18 0014 00
DA 15A0 EIA: 3 Intel 82557 LOM (Fast Ethernet)
5 PCI FFFFFFFF.880A1C40 0 00 PCI
FFFFFFFF.880A2018 8 0010 00
D9 1590 OHA: 1 NEC OHCI USB Controller
FFFFFFFF.880A2128 9 0011 00
D8 1580 OHB: 1 NEC OHCI USB Controller
FFFFFFFF.880A2238 A 0012 00
D7 1570 EHA: 1 NEC EHCI USB Controller
6 PCI FFFFFFFF.880A4800 0 20 PCI
FFFFFFFF.880A4BE8 2008 FFFF FF
FF 0 1 MFPCI
FFFFFFFF.880A4CF8 2010 001D 00
D6 1560 EWA: 2 BCM5701 LOM (Gigabit Ethernet)
7 PCI FFFFFFFF.880A7700 0 20 PCI
FFFFFFFF.880A79D8 2008 001B 00
D5 1550 PKA: 1 LSI Logic 1030 U320
FFFFFFFF.880A7AE8 2009 001C 00
D4 1540 PKB: 1 LSI Logic 1030 U320
8 PCI FFFFFFFF.880AC040 0 40 PCI
9 PCI FFFFFFFF.880B1FC0 0 60 PCI
10 PCI FFFFFFFF.880B7B80 0 80 PCI
11 PCI FFFFFFFF.880BD740 0 C0 PCI
FFFFFFFF.880BDC28 C008 FFFF 00
00 0 1 00000000.01A71014 (..ยง.)
12 PCI FFFFFFFF.880C0740 0 C1 PCI
FFFFFFFF.880C0F58 C120 0047 00
D3 1530 PKC: 4 Smart Array 6400 series
FFFFFFFF.880C1068 C128 0048 00
D2 1520 PKD: 5 Smart Array 6400 series
13 PCI FFFFFFFF.880C7A80 0 E0 PCI
FFFFFFFF.880C7E68 E008 FFFF FF
FF 0 1 MFPCI
FFFFFFFF.880C7F78 E010 0053 00
D1 1510 GHA: 2 ATI Radeon 7000
14 PCI FFFFFFFF.880CA980 0 E0 PCI
FFFFFFFF.880CAC58 E008 0052 00
DF 15F0 1 1291103C.1290103C (<...<...)
FFFFFFFF.880CAD68 E009 0052 00
DF 15F0 SRA: 1 Console Serial Line Driver
SDA>

Does this help?

>>> f = \
'''
System Configuration:
blah blah blah
blah blah blah

System Configuration:
blah blah blah
blah blah blah

System Memory Configuration:
blah blah blah
blah blah blah

System Processor Configuration:
blah blah blah
blah blah blah

System Adapter Configuration:
blah blah blah
blah aha blah blah
blah nope blah blah
blah yay blah blah
'''
>>> 
>>> lines = f.split('\n')
>>> def printinfo():
	adapter_config = False
	for line in lines:
		if adapter_config:
			for word in line.strip().split(' '):
				if word in ('aha', 'yay'):
					print line.strip()
					break
		elif line == 'System Adapter Configuration:':
			adapter_config = True

			
>>> printinfo()
blah aha blah blah
blah yay blah blah
>>>

Does this help?

>>> f = \
'''
System Configuration:
blah blah blah
blah blah blah

System Configuration:
blah blah blah
blah blah blah

System Memory Configuration:
blah blah blah
blah blah blah

System Processor Configuration:
blah blah blah
blah blah blah

System Adapter Configuration:
blah blah blah
blah aha blah blah
blah nope blah blah
blah yay blah blah
'''
>>> 
>>> lines = f.split('\n')
>>> def printinfo():
	adapter_config = False
	for line in lines:
		if adapter_config:
			for word in line.strip().split(' '):
				if word in ('aha', 'yay'):
					print line.strip()
					break
		elif line == 'System Adapter Configuration:':
			adapter_config = True

			
>>> printinfo()
blah aha blah blah
blah yay blah blah
>>>

Hi, Thanks for your reply. But this is not solving my problem plz send me some code which can fetch particular column with the given title. Like in the below output I just want the adapter name without hardcoding the name. My adapter names are ACPI_..., XBUS and PCI in 2nd column.

Thanks in Adv......

System Adapter Configuration:
-----------------------------
TR Adapter ADP Hose Bus BusArrayEntry Node GSIN iVe
c SCB Port Slot Device Name / HW-Id
-- ----------- ----------------- ---- -------------------------- ---- ----------
--------- ---- ---- ---------------------------
1 ACPI_IA64_P FFFFFFFF.8807B800 0 00 IA64_BUS
2 ACPI_IA64_B FFFFFFFF.88087EC0 0 00 IA64_BUS
3 XBUS FFFFFFFF.88099640 0 00 XBUS
FFFFFFFF.88099918 0 0000 FF
FF 0 CMA: 0 IPMI port
FFFFFFFF.88099A28 1 0023 00
DE 15E0 TTA: 1 Generic Com port
FFFFFFFF.88099B38 2 0022 00
DD 15D0 TTB: 2 Generic Com port
FFFFFFFF.88099C48 3 0024 00
DC 15C0 SEA: 3 ACPI System Event
4 PCI FFFFFFFF.8809EC40 0 00 PCI
FFFFFFFF.8809F028 8 FFFF FF
FF 0 1 MFPCI
FFFFFFFF.8809F138 10 0015 00
DB 15B0 DQA: 2 CMD 649 IDE/ATA Controller
FFFFFFFF.8809F248 18 0014 00
DA 15A0 EIA: 3 Intel 82557 LOM (Fast Ethernet)
5 PCI FFFFFFFF.880A1C40 0 00 PCI
FFFFFFFF.880A2018 8 0010 00
D9 1590 OHA: 1 NEC OHCI USB Controller
FFFFFFFF.880A2128 9 0011 00
D8 1580 OHB: 1 NEC OHCI USB Controller
FFFFFFFF.880A2238 A 0012 00
D7 1570 EHA: 1 NEC EHCI USB Controller
6 PCI FFFFFFFF.880A4800 0 20 PCI
FFFFFFFF.880A4BE8 2008 FFFF FF
FF 0 1 MFPCI
FFFFFFFF.880A4CF8 2010 001D 00
D6 1560 EWA: 2 BCM5701 LOM (Gigabit Ethernet)
7 PCI FFFFFFFF.880A7700 0 20 PCI
FFFFFFFF.880A79D8 2008 001B 00
D5 1550 PKA: 1 LSI Logic 1030 U320
FFFFFFFF.880A7AE8 2009 001C 00
D4 1540 PKB: 1 LSI Logic 1030 U320
8 PCI FFFFFFFF.880AC040 0 40 PCI
9 PCI FFFFFFFF.880B1FC0 0 60 PCI
10 PCI FFFFFFFF.880B7B80 0 80 PCI
11 PCI FFFFFFFF.880BD740 0 C0 PCI

This article has been dead for over six months. Start a new discussion instead.