サポートされている速度に合わせてdmidecodeメモリコントローラをフィルタリングする

サポートされている速度に合わせてdmidecodeメモリコントローラをフィルタリングする

Linuxカーネルとすべてのコマンドの初心者として、私はあなたが私の問題を解決するのを手伝ってくれることを願っています。

次のコマンドを実行するとき

sudo dmidecode -t 5

次の結果が表示されます。

# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.4 present.

Handle 0x0084, DMI type 5, 46 bytes
Memory Controller Information
        Error Detecting Method: None
        Error Correcting Capabilities:
                None
        Supported Interleave: One-way Interleave
        Current Interleave: One-way Interleave
        Maximum Memory Module Size: 32768 MB
        Maximum Total Memory Size: 491520 MB
        Supported Speeds:
                70 ns
                60 ns
        Supported Memory Types:
                FPM
                EDO
                DIMM
                SDRAM
        Memory Module Voltage: 3.3 V
        Associated Memory Slots: 15
                0x0085
                0x0086
                0x0087
                0x0088
                0x0089
                0x008A
                0x008B
                0x008C
                0x008D
                0x008E
                0x008F
                0x0090
                0x0091
                0x0092
                0x0093
        Enabled Error Correcting Capabilities:
                None

どのような方法でもサポートされている速度(70ns、60ns)を得るために出力をフィルタリングするコマンドがありますか?

頑張った

sudo dmidecode -t 5 | grep -i -e DMI -e speed

これは私に次のような結果を与えます:

# dmidecode 3.0
Handle 0x0084, DMI type 5, 46 bytes
        Supported Speeds:

ただし、これは次の行を出力しません。

どんな提案でも歓迎します。ありがとうございます!

ベストアンサー1

サポートされている速度が一覧表示されます。

dmidecode | awk '/^\t[^\t]/ { speeds = 0 }; /^\tSupported Speeds:/ { speeds = 1 } /^\t\t/ && speeds'

これは、次のように行を一致させることによって行われます。

  • 単一のタブで始まる行は、速度を期待しないことを意味します。
  • 単一のタブで始まり、その後に「サポートされる速度:」が続く行ははい希望の速度
  • 速度がそのまま出力されると予想されるときに2つのタブで始まる行。

おすすめ記事