I want to grep the motherboard serial number and the product model of a computer. I used
sudo lshw | grep -m1 serial:
to grep the serial number (since there are multiple occurrences of "serial:" and the one I want is the first one. How can I do this AND simultaneously grep for "product:" as well? There are also multiple occurrences of product, and the first one is again the one I want.
lshw returns this:
user@ubuntu:~$ sudo lshw ubuntu-pc description: Notebook product: 23252DG (LENOVO_MT_2325) vendor: LENOVO version: ThinkPad X230 serial: R9TWZVR width: 64 bits capabilities: smbios-2.7 dmi-2.7 vsyscall32 configuration: administrator_password=disabled chassis=notebook family=ThinkPad X230 power-on_password=disabled sku=LENOVO_MT_2325 uuid=01ECC0B1-8251-CB11-8538-B7D9EC435D9B *-core description: Motherboard product: 23252DG vendor: LENOVO physical id: 0 version: Not Defined serial: 1ZPAB2AC2C1 slot: Not Available *-cpu description: CPU product: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz vendor: Intel Corp. physical id: 1 bus info: cpu@0 version: Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz serial: None