Home > OS >  I think through script information about hardware input a list of a column, but don't know how
I think through script information about hardware input a list of a column, but don't know how

Time:09-25

The content of the script:
# memory stick slot
Slot_position=$(dmidecode | grep "Memory Device" - A21 | grep Locator | grep -v "Bank Locator" | awk -f ":" '{print $2}')
Memory # serial number
Memory_Serial=$(dmidecode | grep "Memory Device" - A21 | grep "Serial" | awk -f ":" '{print $2}')
# memory frequency
Memory_Rate=$(dmidecode | grep "Memory Device" - A21 | grep Speed | grep -v "Clock" | awk -f ":" '{print $2}')
Memory # size
Memory_Size=$(dmidecode | grep "Memory Device" - A8 | grep Size | awk -f ":" '{print $2}')
# how many slots
Memory_Slot=$(dmidecode | grep "Memory Device" - A21 | grep Speed | grep -v "Clock" | wc -l)

Printf "% s % s % s % s \ n" memory slot digit memory frequency memory chips memory size serial number
Printf "$Slot_position \ n", "
Printf "$Memory_Rate \ n", "
Printf "$Memory_Size \ n", "
Printf "$Memory_Serial \ n", "


Print out is:
P1 - DIMMA1
P1 - DIMMB1
P1 - DIMMC1
P1 - DIMMD1
P1 - DIMME1
P1 - DIMMF1
The P2 - DIMMA1
The P2 - DIMMB1
The P2 - DIMMC1
The P2 - DIMMD1
The P2 - DIMME1
The P2 - DIMMF1
2666 MHz
Unknown
Unknown
Unknown
Unknown
Unknown
Unknown
Unknown
Unknown
Unknown
Unknown
Unknown
32 GB
No Module Installed
No Module Installed
No Module Installed
No Module Installed
No Module Installed
No Module Installed
No Module Installed
No Module Installed
No Module Installed
No Module Installed
No Module Installed
1 f602710
NO DIMM
NO DIMM
NO DIMM
NO DIMM
NO DIMM
NO DIMM
NO DIMM
NO DIMM
NO DIMM
NO DIMM
NO DIMM

But I want to list format:
P1-2666 MHz DIMMA1 f602710 32 GB 1
P1 - DIMMB1 Unknown No Module Installed No DIMM
P1 - DIMMC1 Unknown No Module Installed No DIMM
P1 - DIMMD1 Unknown No Module Installed No DIMM
P1 - DIMME1 Unknown No Module Installed No DIMM
P1 - DIMMF1 Unknown No Module Installed No DIMM
The P2 - DIMMA1 Unknown No Module Installed No DIMM
The P2 - DIMMB1 Unknown No Module Installed No DIMM
The P2 - DIMMC1 Unknown No Module Installed No DIMM
The P2 - DIMMD1 Unknown No Module Installed No DIMM
The P2 - DIMME1 Unknown No Module Installed No DIMM



How to change?

CodePudding user response:

Cycle print, insert between each column form code



. Ellipsis cycle the content of the above is ok...
P1 - DIMMB1 & lt;/td> Unknown No Module Installed NO DIMM
  • Related