여러 명령을 단일 grep으로 파이프

여러 명령을 단일 grep으로 파이프

여러 명령의 출력을 단일 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 .... 

관련 정보