shell脚本(输出每个内存条的信息)

cat file.txt

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 1

        Locator: DIMM_A1 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: DD8D8261

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 1

        Locator: DIMM_A2 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: E0871151

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 1

        Locator: DIMM_A3 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: E0871155

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 1

        Locator: DIMM_A4 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: E08711A7

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 2

        Locator: DIMM_A5 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 2

        Locator: DIMM_A6 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 2

        Locator: DIMM_A7 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 2

        Locator: DIMM_A8 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 3

        Locator: DIMM_A9 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 3

        Locator: DIMM_A10

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 3

        Locator: DIMM_A11

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 3

        Locator: DIMM_A12

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 4

        Locator: DIMM_B1 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: DC805FF5

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 4

        Locator: DIMM_B2 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: DD8D8256

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 4

        Locator: DIMM_B3 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: E0871153

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: 8192 MB

        Form Factor: DIMM

        Set: 4

        Locator: DIMM_B4 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous Registered (Buffered)

        Speed: 1333 MHz

        Manufacturer: 002C04B3002C

        Serial Number: E0870CEB

        Asset Tag: 08113311

        Part Number: 36KSF1G72PZ-1G4D1 

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 5

        Locator: DIMM_B5 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 5

        Locator: DIMM_B6 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 5

        Locator: DIMM_B7 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 5

        Locator: DIMM_B8 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 6

        Locator: DIMM_B9 

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 6

        Locator: DIMM_B10

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 6

        Locator: DIMM_B11

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:                   

--

Memory Device

        Array Handle: 0x1000

        Error Information Handle: Not Provided

        Total Width: 72 bits

        Data Width: 64 bits

        Size: No Module Installed

        Form Factor: DIMM

        Set: 6

        Locator: DIMM_B12

        Bank Locator: Not Specified

        Type: DDR3

        Type Detail: Synchronous

        Speed: Unknown

        Manufacturer:             

        Serial Number:         

        Asset Tag:         

        Part Number:  


[root@abc ~]# cat file.txt | awk 'BEGIN{RS="--\n";FS="\n"}{print $6,$9,$15}' | grep -v 'No' | awk 'OFS="---" {print $2" "$3,$5,$8}'


8192 MB---DIMM_A1---DD8D8261

8192 MB---DIMM_A2---E0871151

8192 MB---DIMM_A3---E0871155

8192 MB---DIMM_A4---E08711A7

8192 MB---DIMM_B1---DC805FF5

8192 MB---DIMM_B2---DD8D8256

8192 MB---DIMM_B3---E0871153

8192 MB---DIMM_B4---E0870CEB


你可能感兴趣的:(shell,脚本,内存条)