
我想將多個命令的輸出透過管道傳輸到單一 grep。
例子:
我想合併這兩行:
smartctl -A /dev/sda | grep -e Reallocated_Event_Count -e Current_Pending_Sector
smartctl -A /dev/sdb | grep -e Reallocated_Event_Count -e Current_Pending_Sector
(請注意,這兩行之間的唯一區別是磁碟不同:sda 和 sdb)
任何幫助表示讚賞,
謝謝
答案1
你可以試試:
(smartctl -A /dev/sda ; smartctl -A /dev/sdb) | grep -e ....