0

I'd like pipe the output of multiple commands to a single grep.

Example:

I'd like to combine these two lines:

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

(Note that the only difference between these two lines is the disks are different: sda and sdb)

Any help is appreciated,

Thanks

2

You can try:

(smartctl -A /dev/sda ; smartctl -A /dev/sdb) | grep -e .... 
  • Excellent! Thank you! Brackets were the key elements that I was missing in everything that I tried! I'll accept your answer when it lets me :) – jtnire Jun 30 '12 at 15:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.